javaconfig spring

Integrate Spring JavaConfig with legacy configuration

The application I’m working on now uses Spring both by parsing for XML Spring configuration files in pre-determined locations and by scanning annotations-based autowiring. I’ve already stated my stance on autowiring previously, this article only concerns itself on how I could use Spring JavaConfig without migrating the whole existing codebase in a single big refactoring. This is easily achieved by scanning the package where the JavaConfig class is located in the legacy Spring XML conf

javaconfig method injection spring

Spring method injection with Java Configuration

Last week, I described how a Rich Model Object could be used with Spring using Spring’s method injection from an architectural point of view. What is missing, however, is how to use method injection with my new preferred method for configuration, Java Config. My start point is the following, using both autowiring (shudder) and method injection. public abstract class TopCaller { @Autowired private StuffService stuffService; public SomeBean newSomeBean() { return ne

javaconfig spring

Consider replacing Spring XML configuration with JavaConfig

Spring articles are becoming a trend on this blog, I should probably apply for a SpringSource position :-) Colleagues of mine sometimes curse me for my stubbornness in using XML configuration for Spring. Yes, it seems so 2000’s but XML has definite advantages: Configuration is centralized, it’s not scattered among all different components so you can have a nice overview of beans and their wirings in a single placeIf you need to split your files, no problem, Spring let you do that.