首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
Spring 使用 @Value 注解读取配置 properties
Spring 使用 @Value 注解读取配置 properties
mac
2024-04-05
57
1. spring-mvc.xml 文件下加载配置文件(location 中是配置文件的位置)
<!-- 加载配置属性文件 --> <context:property-placeholder ignore-unresolvable="true" location="classpath:config.properties" />
2. 类中使用注解(读取对应的属性)
@Value("${http_base_url}") private String http_base_url;
转载请注明原文地址: https://mac.8miu.com/read-488410.html
最新回复
(
0
)