Hi,
my app seems not instancing propertyplaceholderconfigurer.
That's my applicationContext-business.xml:
myapp.properties (just a row) -> myapp.directory=mydirCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> ....... <bean id="myappSpecificationRepository" class="myapp.MyAppweSpecificationRepository" > <constructor-arg value="${myapp.directory}" /> </bean> <!-- properties --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:myapp.properties</value> </property> </bean> </beans>
and this is my web.xml:
I got this error:Code:<?xml version="1.0" encoding="UTF-8"?> <web-app id="springapp" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>My App</display-name> <description>My App</description> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath*:/applicationContext-business.xml </param-value> </context-param> <!-- To load Spring root WebApplicationContext --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>springapp</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <!-- To load WebApplicationContext for Spring FrameworkServlet 'springapp' (with views and controllers stuff) and attach it to root --> <init-param> <param-name>contextConfigLocation</param-name> <param-value> <!-- classpath*:/springapp-servlet.xml --> classpath*:/applicationContext-business.xml </param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springapp</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> <!-- it contains a redirect to /login.htm --> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <session-config> <session-timeout>30</session-timeout> </session-config> </web-app>
what's wrong???Code:Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'myappSpecificationRepository' defined in class path resource [applicationContext-business.xml]: Could not resolve placeholder 'myapp.directory' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75) at myapp.test.MyAppServiceIntegrationTest.<clinit>(MyAppServiceIntegrationTest.java:28) ... 21 more
Thanks,
Julio


Reply With Quote
