SpringBoot (eighteen) _springboot labeled as war package deployment

Recently in doing the project, due to the use of a springboot, you need to be labeled as war package. I'll go pack the normal way of thinking, the results can not be accessed after deployment, has been an error 404. The follow-up we asked co-workers, he resolved. He said that most of them are for this reason.

If you need to deploy web packaging container by the way, the need to extend coverage SpringBootServletInitializer configure (SpringApplicationBuilder) Method

package com.zhb;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class GirlApplication extends SpringBootServletInitializer {

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

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(GirlApplication.class);
    }
}

Have fun!

Guess you like

Origin www.cnblogs.com/zhenghengbin/p/10995735.html