--- title: 'Spring Boot 小知識彙整' disqus: hackmd --- ###### tags: `SpringBoot` Spring Boot 小知識彙整 === [TOC] ## SpringBoot shut down #因為套件中有使用了webflux,為了讓springboot main starter維持 commandlinerunner 的啟動形式而非web #因此加上此設定 spring.main.web-application-type=none 加在 application.properties [shut down](https://stackoverflow.com/questions/22944144/programmatically-shut-down-spring-boot-application) ## HashMap 各種操作 ```java= // j=-1 // for(Map.Entry<Long,Long> entry : target_Google_CustomerIdMap.entrySet() ) { // j++; // GoogleAdsServiceClientAgent gasAgent = new GoogleAdsServiceClientAgent(entry.getValue(), clientOAuthPropertiesBean); // GoogleAdsClient googleAdsClient = gasAgent.giveMeAnUsefulGoogleAdsClient(); // // SummaryReportBean list= giveMeSingleCustomerPerformanceDuringPeriod(googleAdsClient, entry.getKey(),Google_Start_DateArray[j],Google_End_DateArray[j] ); // targetGoogleReportBeanList.add(list); // } ``` > 利用j=-1來去搭配hashmap 無法搭配index遍歷的結果 ## 開發專案時的小問題 1. hashmap順序會亂掉 2. spring boot app 無法自動關掉