【发布时间】:2014-02-01 14:59:08
【问题描述】:
我正在学习 spring 并试图了解从属性文件中检索值。
我正在尝试以下方式来尝试一些示例
<util:properties id="spelProp" location="classpath:/META-INF/spelProperties.properties"></util:properties>
spelProperties.properties 的内容在哪里
spelTeacher.firstName="First name from Properties"
spelTeacher.lastName="Last name from properties"
我尝试访问 lastName 以便设置 bean 属性之一,例如
<bean id="spelTeacher3Xml" class="com.learningweb.Service.SpelSampleTeacher">
<property name="lastName" value="#{spelProp[spelTeacher.lastName]}" />
</bean>
当我尝试使用 STS 运行时 我收到一个错误 “/META-INF/spelProperties.properties”不存在。
谁能帮我理解这里出了什么问题。 我是否错过了配置类路径或任何 Spring 框架相关设置的任何项目?
感谢您的帮助 (此外,任何理解“类路径:”的参考都会有所帮助。我试图搜索,但我得到了我正在寻找的正确材料。我试图了解类路径:在春季做什么) 谢谢!!!
【问题讨论】:
标签: spring-mvc properties spring-data