Java Spring 3.2资源文件加载问题
我对资源文件进行了如下spring配置,当我在eclipse环境中执行时,它工作得非常好。但是,当我将应用程序打包到JAR中并执行时,它并没有文件属性文件资源Java Spring 3.2资源文件加载问题,java,spring,maven,Java,Spring,Maven,我对资源文件进行了如下spring配置,当我在eclipse环境中执行时,它工作得非常好。但是,当我将应用程序打包到JAR中并执行时,它并没有文件属性文件资源 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlace
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="locations">
<list>
<value>classpath:Application.properties</value>
<value>classpath:database.properties</value>
</list>
</property>
</bean>
<!-- define the properties file to use -->
<util:properties id="appProperties" location="classpath:Application.properties" />
类路径:Application.properties
classpath:database.properties
当我看到jar文件时,所有文件都存在。我正在使用maven构建程序集
项目结构:
ProjName
|
|--主要
|--爪哇
|--资源
另外,我正在使用maven config,使用这个链接(http://stackoverflow.com/questions/13615634/maven-build-assembly-with-dependencies)目前没有足够的信息确切地知道发生了什么。但在我看来,context.xml中存在一些混乱。首先,我建议用
<context:property-placeholder location="classpath:/Application.properties, classpath:/database.properties" />
目前没有足够的信息确切地知道发生了什么。但在我看来,context.xml中存在一些混乱。首先,我建议用
<context:property-placeholder location="classpath:/Application.properties, classpath:/database.properties" />
您是否遇到异常?您可以添加堆栈跟踪吗?您是否遇到异常?可以添加堆栈跟踪吗?