Project skeleton
In these days, more and more poeples are using Spring Boot to get autoconfiguration support and quicker build lifecycle.
For those new to Spring, the regular approache(none Spring Boot) is more easy to understand Spring essential configurations.
Let's us create a Maven based Java EE 7 web application to introduce how to configure a Spring MVC web application in details, then switch to Spring Boot, thus you can compare these two approaches, and understand how Spring Boot simplifies configurations.
Create a Maven based web project
Use the official Java EE 7 web archetype to generate the project skeleton, replace the value of archetypeId and package to yours.
Add Spring dependencies.
Add Spring IO platform platform-bom
to the dependencyManagement section in pom.xml.
You can also use platform-bom as parent of this project.
Read the Apache Maven docs to understand Dependency Mechanism.
platform-bom
manages all dependencies of Spring projects, and you can add dependency declaration directly without specifying a version. platform-bom
manages the versions, and resolved potential conflicts for you.
In order to get IOC container support, you have to add the several core dependencies into pom.xml.
If you would like use @Inject
instead of @Autowire
in codes, add inject dependency.
Get the codes from my github account to explore all configuration classes.
Last updated