Last Updated: February 25, 2016
·
2.202K
· kimble

Abstract classes and Spring 3.1's @Configuration classes goes hand-in-hand

Configuring Spring beans from libraries can be a pain. Lots of small XML context files all over the place and/ or unwanted Spring compile time dependencies are some of the problems.

Properly designed abstract configuration classes combined with Spring 3.1's @Configuration classes goes a long way in taking some of the pain away while reducing the chance of making configuration mistakes.

Example from Spring's MongoDB project:
http://static.springsource.org/spring-data/data-mongodb/docs/current/api/org/springframework/data/mongodb/config/AbstractMongoConfiguration.html