


We can name it anything, but now save it as applicationContext.xml in your maven project. This is the configuration file for the Spring project. Create this file with the "HelloWorldService.java" name. This file contains the code that will print the "Hello Spring" message to the console. HelloWorldService obj = context.getBean(HelloWorldService.class) loading the Bean and XML definitions from the given XML fileĬlassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml") Curious to know, what is Bean? Don't worry, we will cover it later in our tutorial. This file contains code for loading the application context file which is configured to load bean. Now let's see the code in each file one by one.

Project Structure:įollowing will be the project structure of the new project created: After that, your project structure should look like below. You must add Spring Dependencies to this file to configure the application. This project has a pom.xml file that contains configuration and project dependencies. To create the application, we mainly created three files: For more details about creating Maven-based Spring Project read this article Maven Project.Īfter creating a project now, let's create a simple hello spring application. Choose Maven Project because we used maven based spring project. To create a Spring project, click on the File menu and select Project that further popup several project types such as Maven Project, Dynamic Project, Java Project, etc. Add Tomcat 10 to Spring Tools Suite (STS) Create a Spring Project
