So in the latest version of Spring we are able to use the @Configuration annotation to setup our configurations for Spring. Now in JavaConfig it is possible to
Take a look at http://blog.springsource.com/2011/02/17/spring-3-1-m1-featurespec. Spring 3.1's FeatureSpecification classes such as TxAnnotationDriven are designed to solve exactly the problem described above.