idea creates maven's springboot project

Posted by l9pt5 on Sat, 01 Feb 2020 05:52:48 +0100

1. Create a project:

1. Create a new project:

2. Click next

3. Choice dependency:

Select a web project here

4. Customize the project name and path:

The structure path of the created project is as follows:

Project Start:

Click Run to run

The startup log is as follows:

Indicates that the operation was successful.

Access localhost:8080


Indicates that the project was created successfully

2. Write a controller test

Create a demoController:

The demoController code is as follows:

public class DemoController {

    public String demoTest(){
        return "test";

Start DemoApplication again, after successful startup, visit http://localhost:8080/test

Show as test, indicating that the controller was created successfully

At this point, project creation and controller testing have succeeded

By habit, I like to start projects with idea external tomcat

3. Transform the project into one started by idea external tomcat

Refer to this article:

1. In pom.xml settings:


2. Remove dependency on embedded Tomcat in SpringBoot

Delete the class shown above

And add in the pom file:


3. Modify the startup class:

public class DemoApplication extends SpringBootServletInitializer {

    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(DemoApplication.class);

    public static void main(String[] args) {, args);


4. Startup project through tomcat found errors at startup:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource

Check it online because the springboot version is too high

Manually reduce springboot version to 1.5.9.RELEASE

In the pom file:

        <relativePath/> <!-- lookup parent from repository -->

Last Start Successful

The third part refers to foreign articles, the article links are given, and the articles cited explain how to configure tomcat and tomcat startup


31 original articles published, 8 praised, 8552 visited
Private letter follow

Topics: Tomcat SpringBoot Apache Maven