當前位置:
首頁 >
SpringBoot yaml的配置及使用
發布時間:2025/3/15
25
豆豆
生活随笔
收集整理的這篇文章主要介紹了
SpringBoot yaml的配置及使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
application.yml配置如下
person:lastName:?helloage:?18boss:?falsebirth:?2017/12/12maps:?{k1:?v1,k2:?12}lists:‐?lisi‐?zhaoliudog:name:?小狗age:?12?javaBean配置如下:
@Component @ConfigurationProperties(prefix?=?"person") public?class?Person?{private?String?lastName;private?Integer?age;private?Boolean?boss;private?Date?birth;private?Map<String,Object>?maps;private?List<Object>?lists;private?Dog?dog;依賴
<!‐‐導入配置文件處理器,配置文件進行綁定就會有提示‐‐> <dependency> ??????? <groupId>org.springframework.boot</groupId> ??????????? <artifactId>spring‐boot‐configuration‐processor</artifactId> ??????????? <optional>true</optional> ??????????? </dependency>k:(空格)v:表示一對鍵值對(空格必須有);
轉載于:https://www.cnblogs.com/mengjianzhou/p/8983721.html
總結
以上是生活随笔為你收集整理的SpringBoot yaml的配置及使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Vue还有这种骚操作?浅析几个新手常常忽
- 下一篇: JavaScript 对象继承