Spring framework 3.0

I attended BeJUG’s second evening session yesterday. It was a report about the upcoming features in “Spring Framework 3.0”, presented by Alef Arendsen from springsource.

my notes :

3 ways to do dependency injection
, @Autowired and @Bean


-> XML
– SpingIDE helps to check when typing XML ans can display it as object graph
– easy for tooling to generate graphs
– central location for config
– config separate from java code
– easy solution for ambiguity
– you can control code which is out of your control
– perceived XML hell
– lack of type safety
– less refactoring friendly
– names needed to solve ambiguity

@Autowired
– Candidate for autowiring, @Component
– annotate field, constructor, method,… using @Autowired
– autowire-config.xml : lines
– harder for tooling to generate graphs
– “config” is in java code (good or bad)
– more type safe, refactoring friendly
– less verbose
– more difficult to solve ambiguity

Spring 3, @Bean
– write a “factory” which build everything in java, similar to what the XML file did
– annotate class with @Configuration
– annotate methods with @Bean or (when not specifically included) with @ExternalBean
– like factory classes, but with scoping and it wires with the other Spring features
– harder for tooling to generate graphs
– requires a bit more code
– “config” is in java code (good or bad)
– more type safe, refactoring friendly
– less verbose
– easy to solve ambiguity

Configuration options
@Repository
@Service
@Controller
@Endpoint
are also components

Spring lines of code of PetClinic sample drop on each release.

Spring integration : easy messaging, annotations or xml drive the connection with message queues
– based on Gregor Hohpe – Enterprise Integration Patterns
– messaging : async, routing, splitting, aggregating
– works in one VM, but you can use adapters to make it work cross-VM
– interesting read : “Your local coffee shop does not use two-phase commit”

Rest support in Spring MVC
– (ideally) statefless server architecture
– resources (url), actions (get/post/put/delete)
– representations (what should it look like, mime-type (Accept-Header) or based on extension)
– @RequestMapping(“/owners/{ownerId}”, method=RequestMMethod.GET)

Migration of OXM to Sping Framework
– mapping objects to xml, abstraction on top of Castor, Xstream,…

Introduction of expression language support
– simple property handling was already possible
– now proprety replace using a expression language
– replacement will be done at bean instantiation time, eg “${systemProperties.url}”
– will be used by other frameworks like security
@PreAuthorize(“hasRole(‘SUPERVISOR() and (#account.balance+#amount >= -#account.overdraft)”)
public void overdraft( Account account, int amount )

Some stuff will be deprecated, some things will be removed.

Timeline : Q2 2009 for 3.0 RC and release.

SpringOne : end of april in Amsterdam
training session in Brussel second half of februari

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*