springboot transferred from the jar package war package

1.pom.xml the files jar to WAR
2. Add the following content dependencies block in pom.xml

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka</artifactId>
    </dependency>

3. Increase class ServletInitializer, inheritance org.springframework.boot.context.web.SpringBootServletInitializer, configure rewriting method, as follows:

protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {  
    return application.sources(MicroserviceSimpleProviderUserApplication.class);  
} 

Wherein MicroserviceSimpleProviderUserApplication class refers jar is started in packet form main class

Guess you like

Origin blog.csdn.net/l1h2l3/article/details/72724042