springboot与jdk1.6结合使用需要注意的地方
问题描述:官方文档,默认Spring boot 1.3.5 要求 Java7版本,而当前项目要求 Java6,而且在idea工具中创建项目时,如果采用选项“Spring Initializr”来创建工程的话,发现最低只能创建java7的版本,本地环境又只配置了jdk6,所以idea检测不正确版本,无法创建工程,可以通过创建maven项目使idea能够运行Spring boot 1.3.5 与jdk6版本。
添加如下配置即可
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.qy.dsm</groupId>
<artifactId>driverstudymanager</artifactId>
<version>1.0-SNAPSHOT</version>
<name>driverstudymanager</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<java.version>1.6</java.version>
<tomcat.version>7.0.79</tomcat.version>
</properties>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
<defaultGoal>compile</defaultGoal>
</build>
</project>