在springmvc中,想通过注解读取*.properties文件的值,可以采用以下方式
一.在springmvc.xml配置文件中配置
1<!-- 加载配置文件 --> 2<context:property-placeholder location="classpath*:properties/*.properties"/>
二.在相应的bean中注入即可
1 @Value("${projectName}") 2 private String projectName;
Easter79
2021-10-12
在springmvc中,想通过注解读取*.properties文件的值,可以采用以下方式
一.在springmvc.xml配置文件中配置
1<!-- 加载配置文件 --> 2<context:property-placeholder location="classpath*:properties/*.properties"/>
二.在相应的bean中注入即可
1 @Value("${projectName}") 2 private String projectName;