Does anyone use Java-config for Spring framework now?

I was browsing the Spring Java Configuration page.

It says

Although the project should now be considered “decommissioned," resources here will remain indefinitely for posterity:

Does this mean that it is out of date? Does anyone use it in their projects right now? Does it have an advantage over regular xml configuration?

+6
source share
3 answers

While the Spring Java Config project has stopped (web pages remain enabled only to maintain active links), the results of this project were folded into the main Spring project with Spring 3. Therefore, you should not use Java Config project annotations for new code. instead, standard annotations @Bean and @Configuration (and @Value , etc.).

While you are using Spring 3, you can use @Configuration and @Value in the same project as in the XML configuration. I am doing this and it works great for complex configuration issues. (Basically, I prefer to use the XML configuration, as this provides better support in the SpringSource Tool Suite, but for cases where you need to get the class name to instantiate the bean from the property - hey, it's complicated! Then the XML-config does not cut it.)

+10
source

When reading your link, you should switch to @ Bean and @Configuration.

We successfully use the @Configuration annotation. I haven't used @ Bean yet.

0
source

yes .. I used it, and if you are looking for a good resource, you will learn how to check ..

http://johnathanmarksmith.com/Spring/Java/JavaConfig/Programming/2013/04/25/how-to-use-spring-javaconfig-and-not-xml-files-for-configuation/

This is how I learned it from him

-1
source

Source: https://habr.com/ru/post/901600/


All Articles