IDEA maven配置spring-boot


修改 pom.xml 内容如

<?xml version="1.0" encoding="UTF-8"?>

    4.0.0

    
        spring-boot-starter-parent
        org.springframework.boot
        2.3.3.RELEASE
    

    org.example
    Test1
    1.0-SNAPSHOT

    
        1.8
    

    
        
            org.springframework.boot
            spring-boot-starter-web

            
                
                    org.springframework.boot
                    spring-boot-starter-tomcat
                
                
                    org.apache.logging.log4j
                    log4j-to-slf4j
                
            
        

        
            org.springframework.boot
            spring-boot-starter-undertow
        

        
            org.springframework.boot
            spring-boot-configuration-processor
            true
        

    


然后新建一个class

package test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MainApp {
    public static void main(String[] args)
    {
        SpringApplication.run(MainApp.class, args);
    }
}

运行后输出