Day01:新建工程

  • 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-]+\.jar

  • 7、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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容