pom文件
2.0之后的版本似乎不引入也是可以的
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
properties
test.name=test
class
@Component
@PropertySource(value = {"classpath:static/config/setting.properties"},
ignoreResourceNotFound = false, encoding = "UTF-8", name = "setting.properties")
public class PropertiesTest {
@Value("${test.name}")
private String name;
}