标签:nbsp value span code public test private 读取 pre
application.properties
test.name=测试
test.url=www.test.com
1.@Value注解
在controller里可以这样直接调用
@Value("${test.name}") private String name; @Value("${test.url}") private String url;
2.@ConfigurationProperties(prefix="test")
新建一个ConfigTest.java
@Component @ConfigurationProperties(prefix="test") public class ConfigTest(){ private String name; private String url; //get--set }
标签:nbsp value span code public test private 读取 pre
原文地址:https://www.cnblogs.com/javage/p/9160885.html