Archive for the ‘spring’ Category

The self-calling limitation in Spring-AOP and one unintrusive solution

Tuesday, May 29th, 2007

Spring-AOP is implemented by creating proxies decorating the target bean. One typical gotcha from using these proxies, for instance, in declarative transaction management, is the proxy can’t intercept a call made from one method to another on the same target object (typically a service bean), even though both methods are supposed to be wrapped by the proxy. more…

Programmatically Build a Spring Application Context

Sunday, January 14th, 2007

The new BeanDefinitionBuilder class added in Spring 2.0 allows an XML-less way to build application contexts programmatically. Can be very useful for, say, creating quick testing setups in one of those script languages. more…

Spring Controllers with Prototype Scope

Monday, October 9th, 2006

Most of the time, we configure the controllers in our Spring MVC application to be singletons, because of the their stateless nature. However, being configured as normal Spring beans, Spring controllers can also be declared with the prototype scope. more…

A Spring Singleton is not a Singleton

Thursday, September 14th, 2006

OK, I know this sounds like another one of those “a white horse is not a horse” arguments, but from my observation on the Spring forums and other blog reading, some clear distinction between the semantics of a Spring singleton and a classical Java singleton has become much necessary. The overloaded term has caused quite some confusion, especially for someone who has just started picking up Spring. more…

Inject Spring Beans into JSP Tags

Sunday, May 7th, 2006

Spring 2.0 supports injecting beans into an arbitrary POJO, which isn’t necessarily instantiated by a Spring bean factory. This powerful feature is mostly used in injecting into domain objects whose life cycle is usually managed by ORM tools such as Hibernate. But we don’t have to stop here, e.g., JSP tags can also be injected the same way. Here’s how: more…

The Circular Bean Reference Problem in Spring 2.0’s Arbitrary Domain Object Wiring

Monday, February 6th, 2006

Spring 2.0 has an exciting new feature that, with AspectJ’s powerful AOP support, allows arbitrary domain objects to be injected with dependencies at the time of creation, even when the domain object is not created by Spring. This feature helps developers avoiding the “Anemic Domain Model” because now domain objects can have references to services or even DAO’s, instead of just some other domain objects. more…

I Don’t Get “I Don’t Get Spring”

Monday, January 30th, 2006

I was reading Bob Lee’s Spring bashing blog entry, and, while realizing how high the flaming index the article carries, being a long-time Spring advocate, felt that I had to respond. more…

Don’t Forget To Describe Your constructor-arg

Friday, January 20th, 2006

One often overlooked feature in Spring bean definitions is the ability to add a <description> element to almost everything: beans, properties, or constructor arguments. It makes a lot of sense especially in the case of <constructor-arg>, because usually setting a bean property is fairly obvious: more…

Call Me Pedantic – What Exactly IS Scalability?

Monday, January 16th, 2006

This is mostly triggered by Diego Parrilla’s post Spring is not designed for scalability, in which he goes, “…Basically you have two options if you want to scale with pure web applications…”, and then gives two options to scale, both of which involves state replicating clustering schemes. There, Diego, you got on my pedantic nerve. :-) I can’t help but wondering this question – what, exactly is Scalability? more…

Clean Desk, Messy Drawer

Monday, October 17th, 2005

My wife, despite all of her loveliness, does have her own ways of annoying me from time to time, one of which being how she cleans up our office desks – she would sweep everything off the surface of the desk and into the two top drawers, shut them close, and claim “Ta-da! See how neat it looks now!” more…