springboot项目需要在pom文件中添加一下几行:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
.......
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
..........
</dependencies>
配置后,由于我的项目中还有其他的依赖,导致和springboot冲突,运行mvn dependency :tree可以查看依赖的jar包,使用<exclusion></exclusion>去除冲突jar包
然后启动springboot的时候报初始化内置tomcat出错,经查找发现项目中引用了servlet的jar包,去掉servlet依赖。