Spring Boot之配置属性获取
Spring Boot之配置属性获取
1.@PropertySource 类名上面添加注解
@PropertySource({"classpath:application.properties"})
2.@ConfigurationProperties 注解可以设置 key 的前缀
@ConfigurationProperties(prefix = "test")
3.对要配置的属性添加注解
@Value("${web.file.path}")
private String filePath;

浙公网安备 33010602011771号