Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does anyone use Java-config for Spring framework now?

Tags:

java

spring

I was going through the Spring Java Config page.

It says

Though the project should now be considered 'decommissioned', the resources herein will remain indefinitely for posterity's sake:

Does that mean it is obsolete? Does anyone use it in their projects right now ? Does it have any advantage over conventional xml configuration?

like image 420
Vinoth Kumar C M Avatar asked Nov 16 '11 08:11

Vinoth Kumar C M


1 Answers

While the Spring Java Config project has ceased (the webpages remain up just to keep links active) the results of that project have been folded into the main Spring project as of Spring 3. Thus you should not use the Java Config project's annotations for new code, but rather instead the standard @Bean and @Configuration (and @Value, etc.) annotations.

So long as you use Spring 3, you can use @Configuration and @Value in the same project as XML configuration. I am doing this and it works really well for complex configuration problems. (I mostly prefer to use XML configuration still, as that gives better support in SpringSource Tool Suite, but for cases where you need to get the name of a class to instantiate for a bean from a property — hey, it's tricky! — then XML config doesn't cut it.)

like image 169
Donal Fellows Avatar answered Sep 24 '22 03:09

Donal Fellows