- 1、 修改java版本
<properties><java.version>1.8</java.version></properties>
- 2、 maven plugin to build a exec jar
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
- 3、 自動(dòng)配置/掃描的注解
@SpringBootApplication || @EnableAutoConfiguration
- 4、替換默認(rèn)的配置
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
- 5、devtools
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> </dependencies>
- 排除重啟監(jiān)聽(tīng)的目錄或者文件:spring.devtools.restart.exclude=static/,public/
- 保持默認(rèn)并添加額外的排除:spring.devtools.restart.additional-exclude
- 監(jiān)聽(tīng)classpath外的文件:spring.devtools.restart.additional-paths
- 完全的關(guān)閉重啟服務(wù):在main函數(shù)中,
System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(MyApp.class, args); - 觸發(fā)文件:spring.devtools.restart.trigger-file
6、自定義restart classloader
新建文件:META-INF/spring-devtools.properties
文件包含:restart.exclude. and restart.include. prefixed properties,具體屬性內(nèi)容為正則表達(dá)式
restart.exclude.companycommonlibs=/mycorp-common-[\\w-]+\.jar restart.include.projectcommon=/mycorp-myproj-[\\w-]+\.jar7、remote application
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <excludeDevtools>false</excludeDevtools> </configuration> </plugin> </plugins> </build>
在porperties配置文件中添加:spring.devtools.remote.secret=mysecret
- 8、 代理訪問(wèn)設(shè)置
spring.devtools.remote.proxy.host
spring.devtools.remote.proxy.port