【发布时间】:2017-07-25 13:35:29
【问题描述】:
我正在使用@ProprtySource 读取属性文件,下面是我的代码-
@PropertySource(value="classpath:/application.properties")
public class HomeService{
@Value("${message}")
String message;
}
也在我的 JSP 中-
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<spring:eval expression="@environment.getProperty('message')" />
两者都工作正常。
注意:我没有注册任何propertySourcePlaceHolderConfigurer或ResourceBundle,即除了上面没有其他配置。
但是我一申请spring:message as-
<spring:message code="message"/>
这给了我例外-
javax.servlet.jsp.JspTagException:在区域设置“en_US”的代码“消息”下找不到消息。
【问题讨论】:
标签: spring jsp properties