Spring MVC не найден конструктор по умолчанию?

У меня проблемы с моими контроллерами Spring - конструктор по умолчанию не найден - но у них есть конструктор, который я пытаюсь создать через applicationContext.xml - вот соответствующий бит:

<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>

Т.е. Сначала я создаю bean-компонент, а затем пытаюсь передать результат вызова метода из этого bean-компонента конструктору второго bean-компонента (CacheHandler).

Вот начало CacheHandler:

    @Controller
    public class CacheHandler {

    private final CustomGxSessionIdCacheImpl gxSessionIdCache;

    public CacheHandler(CustomGxSessionIdCacheImpl gxSessionIdCache) {
        this.gxSessionIdCache = gxSessionIdCache;
    }

Вот ошибка, которую я получаю:

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>()

Любая помощь приветствуется!

12
задан ndeverge 15 February 2012 в 16:34
поделиться