springboot(3)之yaml通过@configurationProperties和@value注入值

使用@configurationproperties
首先使用@comment在spring容器中注册javabean
然后@configurationproperties(prefix)定义前缀,就可以在yml中定义数据了
springboot(3)之yaml通过@configurationProperties和@value注入值
当value和configurationproperties同时出现时,以configurationproperties优先级高
springboot(3)之yaml通过@configurationProperties和@value注入值
使用@propertySource(value={“classpath:”}),这个注解只能加载properties,不能加载yml文件