If you are a developer new to the Spring framework, getting started can be daunting. Let us walk through a basic configuration and setup of a Spring project using Maven for dependency resolution.
I will assume that you have Eclipse or the Spring Tool Suite IDE installed with Maven m2eclipse.
1.In the IDE, choose File > New > Project to access the New Project window.
2.Open the Maven folder, and choose Maven Project. Click Next. Navigate through the wizard, and set up the Maven project with desired names and parameters.
3.Right-click on the src/main/resources directory, and choose New > Folder. Name this folder Spring.
4.Right-click on the newly created Spring folder, and choose New > File. Name this new file application-context.xml.
5.Enter the proper boiler-plate code for the Spring application-context.xml. You may see this code in the tutorial screenshot or by doing a quick Google search for Spring application context code. This code sets the required XML namespaces for the Spring configuration. Further Spring configuration will go between the tags. Also, notice the component-scan tag. This tells Spring to scan the base-package specified in the tag, and it is the mechanism by which Spring becomes aware of the project’s Java beans.
6.Before you build and run your Spring project, it is necessary to ensure that all required Spring dependencies are configured properly with Maven. In the IDE, open the Maven pom.xml file to edit the required dependencies. Place all required dependencies between the tags. For a basic Spring project, usually just spring-core and spring-beans are required, but it is necessary to resolve all required dependencies in Maven that are defined in the Spring application-context.xml.
Now that your Spring project’s application-context.xml file is configured, it is possible to create Java beans in your project and have these beans managed by Spring.