I'm using the following from the wicket spring page:

public class MainApplication extends WebApplication
{
    /**
     * @see org.apache.wicket.protocol.http.WebApplication#init()
     */
    @Override
    protected void init()
    {
        super.init();

        // http://cwiki.apache.org/WICKET/spring.html
        final SpringComponentInjector spring = new
SpringComponentInjector(this);
        addComponentInstantiationListener(spring);
    }


and spring indeed is wiring up the daos and services. The @Service beans are
correctly receieving their @Respository dependencies. It is just the wicket
page '@SpringBean' annotation don't seem to be able to fine the beans
annotated with @Service.

Is it possible that @Autowire doesn't work with @SpringBean and that I need
to explicitly list dependencies in a config file?

-Luther




On Sun, May 31, 2009 at 3:55 PM, Igor Vaynberg <[email protected]>wrote:

> have you read the wicket spring wiki page? you have to install the
> spring component injector for this to work.
>
> -igor
>
> On Sun, May 31, 2009 at 1:15 PM, Luther Baker <[email protected]>
> wrote:
> > I'm working on a project with Spring/Wicket integration.
> >
> > I have most of the Spring autowire stuff working ...
> >
> > My @Repository(s) are successfully autowires to my @Service(s). In
> SpringMVC
> > speak then, the @Service would autowire to the *...@controller*. But of
> course,
> > I am using wicket, not Spring MVC. Per the wicket/spring doc
> > page<http://cwiki.apache.org/WICKET/spring.html>,
> > which describes the *...@springbean* annotation, as opposed to the
> *...@controller
> > * annotation, in my pages. Unfortunately, I get an error and the stack
> trace
> > includes:
> >
> > Caused by: java.lang.IllegalStateException: bean of type
> > [org.effectiveprogramming.effprog.service.PostService] not found
> >
> > Is this expected? Before deep diving I'm curious to confirm that
> > spring-wicket integration is definitely supposed to work with Spring
> > autowiring. Thoughts?
> >
> > Thanks.
> >
> > -Luther
> >
> >
> > --------
> >
> > @Repository
> > public class PostDaoImpl extends PostDao
> > {
> > ...
> > }
> >
> > --------
> >
> > @Service
> > public class PostServiceImpl implements PostService
> > {
> > ...
> >    @Autowired
> >    public void setPostDao(final PostDao postDao)
> >    {
> >        this.postDao = postDao;
> >    }
> > }
> >
> > --------
> >
> > public class HomePage extends BasicLayout
> > {
> >    @SpringBean
> >    private PostService postService;
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to