KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having problems with my Spring controllers - I'm getting no default constructor found - but they do have a constructor which I am trying to created via the applicationContext.xml - heres the relevant bit: <bean id="PcrfSimulator" class="com.rory.services.pcrf.simulator.PcrfSimulator" init-method="start"> </bean> <bean id="CacheHandler" class="com.rory.services.pcrf.simulator.handlers.CacheHandler"> <constructor-arg index="0" type="com.rory.services.pcrf.simulator.CustomGxSessionIdCacheImpl"> <bean factory-bean="PcrfSimulator" factory-method="getGxSessionIdCache"> </bean> </constructor-arg> </bean> Ie. I'm creating a bean first, and then trying to pass the result of a method call from that bean into the second bean's (CacheHandler) constructor. Here'e the start of CacheHandler: @Controller public class CacheHandler { private final CustomGxSessionIdCacheImpl gxSessionIdCache; public CacheHandler(CustomGxSessionIdCacheImpl gxSessionIdCache) { this.gxSessionIdCache = gxSessionIdCache; } Here's the error I'm getting: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheHandler' defined in URL [jar:file:/users/rtorney/Documents/apache-tomcat-7.0.25/webapps/PCRFSimulator-4.0/WEB-INF/lib/PCRFSimulator-4.0.jar!/com/rory/services/pcrf/simulator/handlers/CacheHandler.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.rory.services.pcrf.simulator.handlers.CacheHandler]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.rory.services.pcrf.simulator.handlers.CacheHandler.<init>() Any help is much appreciated!
Tags (comma-separated)
Save Edits
Cancel