Bootstrapping a web application with Spring 3.1 and Java based Configuration, part 1 | baeldung
Others:
Others:
- Part 2 – Building a RESTful Web Service with Spring 3.1 and Java based Configuration
- Part 3 – Securing a RESTful Web Service with Spring Security 3.1
- Part 4 – RESTful Web Service Discoverability
- Part 5 – REST Service Discoverability with Spring
Spring 3.1.0.BUILD-SNAPSHOT
- The Spring framework snapshot repository is included so that Maven will be able to access the latest Spring snapshots – 3.1.0.BUILD-SNAPSHOT.
- http://maven.springframework.org/snapshot
- I’m using the snapshots for this post because some really useful stuff has been added since 3.1.0.M2, especially in the area of Java based configuration for MVC.
- For the purposes of this post however, 3.1.0.M2 works fine, as none of the new additions are in use for the bootstrapping part.
- In order to use this version, the snapshot repository should be replaced with:
- http://maven.springframework.org/milestone
CGLIB
- Why CGLIB is a dependency?
- The entire configuration cannot function without it.
- If removed, Spring will throw:
- java.lang.IllegalStateException:
- CGLIB is required to process @Configuration classes.
- Either add CGLIB to the classpath or remove the following @Configuration bean definitions
- @Configuration
- Effective
- Configuration classes should not be final
- They should have a constructor with no arguments
- 4. The IoC container, 4.12 - Java-based container configuration
- @ImportResource
- Is used to import the existing XML based Spring configuration.
- This may be configuration which is still being migrated from XML to Java
- Or simply legacy configuration that you wish to keep.
- Either way, importing into the Container is essential for a successful migration, allowing small steps without too much risk.
- Equivalent XML annotation:
- <import resource="classpath*:/rest_config.xml"/>
No comments:
Post a Comment