springboot war包模式改成jar包模式

1.注释war包模式


<packaging>jarpackaging>

2.注释war-plugin



<build>
<plugins>
    <plugin>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-maven-pluginartifactId>
        <configuration>
        <mainClass>org.supwisdom.ApplicationmainClass> 
        configuration>
    plugin>
plugins>
build>

3.注释掉spring-boot-starter-tomcat相关依赖

4.注释Application.java中SpringApplicationBuilder configure

//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
     
//        return application.sources(Application.class);
//    }
    
    public static void main(String[] args) throws Exception {
     
    	System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(Application.class, args);
    }

启动方式:
cd 当前服务pom.xml同目录下
mvn clean package
java -jar target/***.jar

你可能感兴趣的:(springboot学习,springboot,war,jar)