我有一個「details.yml」文件,考慮從「yml.file」獲取所有值的所有設置完成。但我無法映射值存入 「地圖」如何從「yml」文件獲取地圖值作爲Map?
Here is my "details.yml" file below
details:
company:XYZ
values:
name: Manish
last: Raut
在我的類文件,我能夠得到「公司」從陽明文件使用@Value(「$ {}公司的價值觀「)
@Component
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "details")
public class abcd() {
@Value("${company}")
String company;
@Value("${values}")
Map<String, String> values =new HashMap<String, String>();
...............................
}
我不能在毛澤東中得到那些我在這堂課創建的價值,但我得到了」公司「的價值。
幫我這個忙嗎?
希望下面的鏈接可以幫助你。 [https://stackoverflow.com/questions/24917194/spring-boot-inject-map-from-application-yml](https://stackoverflow.com/questions/24917194/spring-boot-inject-map-from-應用程序-yml) –