在Spring boot中加入web.xml
来源:互联网 发布:intelij idea java web 编辑:程序博客网 时间:2024/06/04 19:54
公司有个项目,有两个子项目,两个独立的工程,我们组用的Spring boot,没有web.xml的,另一个项目组是用的liferay,有liferay6定制的tomcat7,做到中后期,客户说要放在一个tomcat里面,但是spring boot的war包放在liferay的tomcat下报错,特么只好去找怎么在spring boot里面搞个web.xml。。。
先在java/webapp/WEB-INF/下面加入web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"><context-param><param-name>contextConfigLocation</param-name><param-value>com.robbie.SpringBootTraditionalApplication</param-value></context-param><listener><listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class></listener><servlet><servlet-name>appServlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextAttribute</param-name><param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>appServlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping></web-app>
maven配置加入这些(必须的)
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope></dependency><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-legacy</artifactId> <version>1.1.0.RELEASE</version></dependency><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId></dependency>
在代码中去掉所有关于Servlet的配置
比如SpringBootServletInitializer
也不能用FilterRegistrationBean和ServletRegistrationBean注册Filter和Servlet了,应该在web.xml里面配置
阅读全文
0 0
- 在Spring boot中加入web.xml
- 在web.xml中加入过滤器
- 在web.xml文件中加入Spring的utf-8过滤器
- spring笔记7-在web中加入Spring
- Web.xml 中加入log4j
- 在web.xml文件中配置Spring
- 在web.xml中配置Spring
- 在Spring中加入Struts2
- 在web工程中使用spring(web.xml)
- web.xml中加入标签时报错 |
- spring3 mvc中 web.xml 加入 OpenSessionInView
- 解决在MyEclipse下生成的web.xml中加入taglib时报错的问题
- 在web.xml中透过contextConfigLocation配备spring
- Spring 中在web.xml的常用配置
- SSH框架整合中:spring在web.xml中的配置
- Spring, Log4j, 等各项在web.xml中配置
- 在WEB.xml文件中配置Spring容器
- 加载spring在web.xml中相关配置
- 算法提高 盾神与条状项链 java
- 反射获取List中的泛型
- python函数详解
- 根据条件更新字段
- 单片机原理(3):中断、定时/计数、串行通信
- 在Spring boot中加入web.xml
- AndroidStudio3.0使用过程中遇到的bug
- Spring boot中去掉URL后面的jsessionid
- c++对象成员的引用,对象的赋值,对象指针或对象引用
- MongoDB视频教程
- Ring3下的DLL注入工具
- LeetCode-697. Degree of an Array
- Angular 4 上传多个文件到Spring boot
- Axure实战案例——点击跳转页码