zoukankan      html  css  js  c++  java
  • tomcat7里放springboot

    首先在pom文件里加入

    这个就是表示内嵌tomcat只在编译和测试时候使用
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
    </dependency>

    然后要继承SpringBootServletInitializer并重写它的方法
    下面代码
    @Import(YmlConfigUtil.class)
    @Configuration
    @SpringBootApplication
    @EnableTransactionManagement //如果mybatis中service实现类中需要加入事务注解,需要此处添加该注解
    @MapperScan(value = "com.cck.mapper")
    public class PortalServerApplication extends SpringBootServletInitializer {

    //TODO
    /**
    * 打war包专用 war包打开 启动类继承 extends SpringBootServletInitializer
    **/
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(PortalServerApplication.class);
    }



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


    最后如果还不行的话
    在tomcat7中有el-api.jar,但是太老了,并不支持spring boot,
    自己去tomcat8里面粘出一个来,替换掉就好.
    并不会给tomcat7带来不好的影响





  • 相关阅读:
    支付宝沙箱环境应用
    七牛云视频托管
    腾讯云短息验证码接口
    git远程连接(码云)
    git
    字间距
    html文本保留空格
    mysql重启导致AUTO_INCREMENT从1开始
    js保留两位小数
    vue中watch的基本用法
  • 原文地址:https://www.cnblogs.com/cjb1/p/11315853.html
Copyright © 2011-2022 走看看