I am using maven, spring 2.5.6, wicket 1.4 and am trying to inject my DAO's
into my wicket models but I find that Spring just ignores my advice.

My question:
1. @SpringBean only works on stuff that inherits from Component. What do I
do with things like session and models that don't? I am trying to use
@Configurable but that is being ignored.
2. My POM deps are below. What should I pull in to have @Configurable
working?
3. BTW. When I comment the bean out of my XML config, then I do get an error
so I am not sure if I am doing something very small wrong?

Thanks.
Pieter

pom.xml
=======
...
       <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.wicket</groupId>
            <artifactId>wicket-spring</artifactId>
            <version>${wicket.version}</version>
      <!--Same results whether I include or exclude the next session-->
      <exclusions>
        <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring</artifactId>
        </exclusion>
      </exclusions>
        </dependency>
....


TemplateWebModel.java
==================
.....
@Configurable
public class TemplateWebModel extends AbstractDataSetWebModel<Template> {

    private TemplateFactory templateFactory;

    public TemplateFactory getTemplateFactory() {
        return templateFactory;
    }

    public void setTemplateFactory(TemplateFactory templateFactory) {
       throw new RuntimeException("REACHED TEMPLATE FACTORY SET"); //This
setter is never run!!!!
        //this.templateFactory = templateFactory;
    }
.....

WicketApplicationDefinitition.xml
==========================

<?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:context="http://www.springframework.org/schema/context";
       xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd";>

    <context:annotation-config/>
<!--<aop:aspectj-autoproxy/>-->

<!-- a bean that supplies my primary application database client -->
    <bean id="appDataSource" class="com.musmato.dao.ApplicationDBFactory"
        destroy-method="close">
        <constructor-arg>
            <ref bean="appConfig" />
        </constructor-arg>
    </bean>

<!-- a bean that supplies a network database client for template uploads -->
    <bean id="rootDataSource" class="com.musmato.dao.RootDBFactory"
destroy-method="close">
        <constructor-arg>
            <ref bean="appConfig" />
        </constructor-arg>
    </bean>
.....
    <bean id="TemplateFactory" class="com.musmato.dao.TemplateFactory">
        <property name="client" ref="appDataSource" />
    </bean>
....





-- 
Pieter Claassen
musmato.com

Reply via email to