Jay Roy
asked on
Error on Inner bean
hi guys
I have a bean defined
<bean id="propertyConfigurer"
class="org.springframework .beans.fac tory.confi g.Property Placeholde rConfigure r">
<property name="locations">
<list>
<value>classpath:/WEB-INF/ config/com mon/devccc .propertie s</value>
</list>
</property>
</bean>
The above bean loads the properties file. then i do this
<bean id="businessService" class="com.services.WorkBu sinessServ ice">
<property name="workDao">
<ref bean="workDao" />
</property>
<property name="emailservice" ref="emailservice"/> --defining an inner bean
</bean>
<bean id="emailservice" class="org.springframework .beans.fac tory.confi g.Property Placeholde rConfigure r">
<property name="emailHost" value="${email.host}"/> --These are the properties values
<property name="url" value="${application.url}" />
</bean>
I get an error
0000008 ContextLoader E org.springframework.web.co ntext.Cont extLoader initWebApplicationContext Context initialization failed
org.springframework.beans. factory.Be anCreation Exception: Error creating bean with name 'emailservice' defined in class
path resource [WEB-INF/config/app-config .xml]: Error setting property values; nested exception is org.springframework.beans. NotWritabl ePropertyE xception: Invalid property 'emailHost' of bean class [org.springframework.beans .factory.c onfig.Prop ertyPlaceh olderConfi gurer]: Bean property 'emailHost' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans. factory.su pport.Abst ractAutowi reCapableB eanFactory .applyProp ertyValues (AbstractA utowireCap ableBeanFa ctory.java :1361)
at org.springframework.beans. factory.su pport.Abst ractAutowi reCapableB eanFactory .populateB ean(Abstra ctAutowire CapableBea nFactory.j ava:1086)
at org.springframework.
I have defined a setter method in WorkBusinessService class
public void setEmailHost(String emailHost) {
this.emailHost = emailHost;
}
any idea where i am going wrong?
thanks
I have a bean defined
<bean id="propertyConfigurer"
class="org.springframework
<property name="locations">
<list>
<value>classpath:/WEB-INF/
</list>
</property>
</bean>
The above bean loads the properties file. then i do this
<bean id="businessService" class="com.services.WorkBu
<property name="workDao">
<ref bean="workDao" />
</property>
<property name="emailservice" ref="emailservice"/> --defining an inner bean
</bean>
<bean id="emailservice" class="org.springframework
<property name="emailHost" value="${email.host}"/> --These are the properties values
<property name="url" value="${application.url}"
</bean>
I get an error
0000008 ContextLoader E org.springframework.web.co
org.springframework.beans.
path resource [WEB-INF/config/app-config
at org.springframework.beans.
at org.springframework.beans.
at org.springframework.
I have defined a setter method in WorkBusinessService class
public void setEmailHost(String emailHost) {
this.emailHost = emailHost;
}
any idea where i am going wrong?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
https://www.experts-exchange.com/questions/26943158/spring-AOP-with-transactions.html
thanks