美文网首页
SpringBoot 的@Value 读取不到值下面是重点注意的

SpringBoot 的@Value 读取不到值下面是重点注意的

作者: 在暗处凝视世间喧华繁闹 | 来源:发表于2018-09-24 15:13 被阅读0次

类上有这三个标签: 

@Component

@ConfigurationProperties(prefix = "file")

@Value("${file.hostname}")

 有这个jar包

 <dependency> 

    <groupId>org.springframework.boot</groupId> 

    <artifactId>spring-boot-configuration-processor</artifactId> 

        <optional>true</optional> 

</dependency>

类的加载得这样

不能new

相关文章

网友评论

      本文标题:SpringBoot 的@Value 读取不到值下面是重点注意的

      本文链接:https://www.haomeiwen.com/subject/juzcoftx.html