1.修改maven的pom.xml配置文件
<build>
<plugins>
<!-- 如果我们要直接Main启动spring,那么以下plugin必须要添加,否则是无法启动的,打可执行的jar包 -->
<!-- spring boot热部署 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.6.RELEASE</version>
<dependencies>
<!--springloaded hot deploy -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.4.RELEASE</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
<configuration>
<!-- <layout>ZIP</layout>必须要配置-->
<layout>ZIP</layout>
<mainClass>bframe.Main</mainClass>
<includes>
<include>
<!-- 需要打尽量的jar包 -->
<groupId>bframe-parent</groupId>
<artifactId>bframe-aut-dao</artifactId>
</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
2.项目启动的时候增加-Dloader.path参数,如下lib放这我们么有打进去的其他jar包
java -Dloader.path=lib/ -Dfile.encoding=utf-8 -jar abc-api-1.0.0-SNAPSHOT-exec.jar