Thanks Jeoren.

I wasn't using @Component - that could very well be it.

I'll try it - and thanks for suggestion.

-Luther



On Tue, Jun 2, 2009 at 2:42 PM, Jeroen Steenbeeke <[email protected]
> wrote:

> Not sure if this will help, but I have the following in my Spring
> configuration file:
> <?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 />
>
>  <context:component-scan
>  base-package="path.to.my.beans.impl" />
> </beans>
> For each bean implementation I use
> @org.springframework.stereotype.Component, and for each property that needs
> to be set on these beans I use
> @org.springframework.beans.factory.annotation.Autowired.
> This way you can do the following:
>
> @Component
> public class FooServiceImpl implements FooService {
>  @Autowired
>  private BarService bar;
>  public void doSomething() {
>    // Does something
>  }
>  public void setBar(BarService bar) {
>    this.bar = bar;
>  }
> }
> And in your Wicket pages you use:
> public class MyPage extends Page {
>  @SpringBean
>  private FooService service;
>  public MyPage() {
>    super();
>    service.doSomething();
>  }
> }
> And of course, don't forget the SpringComponentInjector (which you already
> have) - and the required fields in your web.xml:
>
> <context-param>
>  <param-name>contextConfigLocation</param-name>
>  <param-value>classpath:your_application_context.xml</param-value>
>  </context-param>
> Hope this helps,
> Jeroen
>

Reply via email to