IDEA Springboot版本降级匹配java7

idea创建Springboot项目,最低版本只能选择java8,但是生产环境的jdk是1.7。

按java8创建好之后,先把jdk改了:

 

按对应关系修改pom中的Springboot版本:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.17.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
Sping BootSpring FrameworkJavaMavenGradle
Spring Boot 2.1.x
2.1.0.RELEASESpring Framework 5.1.2.RELEASEJava 8 or 93.3+4.4+
Spring Boot 2.0.x
2.0.6.RELEASESpring Framework 5.0.10.RELEASEJava 8 or 93.2+4.x
2.0.5.RELEASESpring Framework 5.0.9.RELEASE4.x
2.0.4.RELEASESpring Framework 5.0.8.RELEASE4
2.0.3.RELEASESpring Framework 5.0.7.RELEASE4
2.0.2.RELEASESpring Framework 5.0.6.RELEASE4
2.0.1.RELEASESpring Framework 5.0.5.RELEASE4
2.0.0.RELEASESpring Framework 5.0.4.RELEASE4
Spring Boot 1.5.x
1.5.17.RELEASESpring Framework 4.3.20.RELEASEJava 73.2+[2.9, 3.x]
1.5.16.RELEASESpring Framework 4.3.19.RELEASE
1.5.15.RELEASESpring Framework 4.3.18.RELEASE
1.5.14.RELEASESpring Framework 4.3.18.RELEASE
1.5.13.RELEASESpring Framework 4.3.17.RELEASE
1.5.12.RELEASESpring Framework 4.3.16.RELEASE
1.5.11.RELEASESpring Framework 4.3.15.RELEASE
1.5.10.RELEASESpring Framework 4.3.14.RELEASE
1.5.9.RELEASESpring Framework 4.3.13.RELEASE
1.5.8.RELEASESpring Framework 4.3.12.RELEASE
1.5.7.RELEASESpring Framework 4.3.11.RELEASE
1.5.6.RELEASESpring Framework 4.3.10.RELEASE
1.5.5.RELEASESpring Framework 4.3.10.RELEASE
1.5.4.RELEASESpring Framework 4.3.9.RELEASE
1.5.3.RELEASESpring Framework 4.3.8.RELEASE
1.5.2.RELEASESpring Framework 4.3.7.RELEASE
1.5.1.RELEASESpring Framework 4.3.6.RELEASE
1.5.0.RELEASESpring Framework 4.3.6.RELEASE
Spring Boot 1.4.x
1.4.7.RELEASESpring Framework 4.3.9.RELEASEJava 73.2+

[1.12, 2.x]

1.4.6.RELEASESpring Framework 4.3.8.RELEASE
1.4.5.RELEASESpring Framework 4.3.7.RELEASE
1.4.4.RELEASESpring Framework 4.3.6.RELEASE
1.4.3.RELEASESpring Framework 4.3.5.RELEASE
1.4.2.RELEASESpring Framework 4.3.4.RELEASE
1.4.1.RELEASESpring Framework 4.3.3.RELEASE
1.4.0.RELEASESpring Framework 4.3.2.RELEASE
Spring Boot 1.3.x
1.3.8.RELEASESpring Framework 4.2.8.RELEASE

Java 7

3.2+

[1.12, 2.x]
1.3.7.RELEASESpring Framework 4.2.7.RELEASE1.12+
1.3.6.RELEASESpring Framework 4.2.7.RELEASE
1.3.5.RELEASESpring Framework 4.2.6.RELEASE
1.3.4.RELEASESpring Framework 4.2.6.RELEASE
1.3.3.RELEASESpring Framework 4.1.5 or above
1.3.2.RELEASE
1.3.1.RELEASE
1.3.0.RELEASE
Spring Boot 1.2.x
1.2.8.RELEASESpring Framework 4.1.5 or aboveJava 73.2+1.12+
1.2.7.RELEASE
1.2.6.RELEASE
1.2.5.RELEASE
1.2.4.RELEASE
1.2.3.RELEASE
1.2.2.RELEASE
1.2.1.RELEASESpring Framework 4.1.3 or aboveJava 6
1.2.0.RELEASE

直接修改<parent>标签的版本可能不会生效,需要先将starter依赖注释,reload maven,还不行的话重启下idea。

        <!--        <dependency>-->
        <!--            <groupId>org.springframework.boot</groupId>-->
        <!--            <artifactId>spring-boot-starter-web</artifactId>-->
        <!--        </dependency>-->
        <!--        <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-starter-jdbc</artifactId>-->
        <!--        </dependency>-->
        <!--        <dependency>-->
        <!--            <groupId>org.springframework.boot</groupId>-->
        <!--            <artifactId>spring-boot-starter-test</artifactId>-->
        <!--            <scope>test</scope>-->
        <!--        </dependency>-->
如果是打成war包,SpringBootServletInitializer需要修改,将引用里的servlet去掉即可:

jar包降级:

 

 

application配置文件修改:

server.servlet.context-path改为server.context-path
server:
  port: 8888
  context-path: /app

配置修改结束,运行成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值