在Spring boot中加入web.xml

公司有个项目,有两个子项目,两个独立的工程,我们组用的Spring boot,没有web.xml的,另一个项目组是用的liferay,有liferay6定制的tomcat7,做到中后期,客户说要放在一个tomcat里面,但是spring boot的war包放在liferay的tomcat下报错,特么只好去找怎么在spring boot里面搞个web.xml。。。
先在java/webapp/WEB-INF/下面加入web.xml

 


	
		contextConfigLocation
		com.robbie.SpringBootTraditionalApplication
	
	
		org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener
	
	
		appServlet
		org.springframework.web.servlet.DispatcherServlet
		
			contextAttribute
			org.springframework.web.context.WebApplicationContext.ROOT
		
		1
	
	
		appServlet
		/
	

 maven配置加入这些(必须的)

 

 


    org.springframework.boot
    spring-boot-starter-tomcat
    provided


    org.springframework.boot
    spring-boot-legacy
    1.1.0.RELEASE


    org.springframework.boot
    spring-boot-starter-actuator

在代码中去掉所有关于Servlet的配置

 

比如SpringBootServletInitializer

也不能用FilterRegistrationBean和ServletRegistrationBean注册Filter和Servlet了,应该在web.xml里面配置

 

你可能感兴趣的:(在Spring boot中加入web.xml)