Thanks for the suggestion Vasu. I tried this in my 'Service' class:
@Service(value = "logServiceImpl")
public class LogServiceImpl implements LogService
{
...
and this in my page:
public class Home extends BasicLayout
{
@SpringBean(name = "logServiceImpl")
private LogService logService;
...
as well as
public class Home extends BasicLayout
{
@SpringBean
private LogService logService;
I even changed the type in the destination classes to LogServiceImpl and no
luck.
I'm afraid the @Autowire stuff in Spring doesn't work seem to work with
@SpringBean.
Again, thanks for the suggestion. I'm thinking to go back to Guice and
manage transactions without Spring.
-Luther
Depending on what I'm testing, errors look like:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'logServiceImpl' is defined
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:971)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:358)
at
org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:896)
at
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:135)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:92)
at org.apache.wicket.injection.Injector.inject(Injector.java:108)
or
java.lang.IllegalStateException: bean of type
[com.fuzzybearings.fuzzy.service.LogService] not found
at
org.apache.wicket.spring.SpringBeanLocator.getBeanNameOfClass(SpringBeanLocator.java:109)
at
org.apache.wicket.spring.SpringBeanLocator.getBeanName(SpringBeanLocator.java:195)
at
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:135)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:92)
at org.apache.wicket.injection.Injector.inject(Injector.java:108)
or
java.lang.IllegalStateException: bean of type
[com.fuzzybearings.fuzzy.service.LogServiceImpl] not found
at
org.apache.wicket.spring.SpringBeanLocator.getBeanNameOfClass(SpringBeanLocator.java:109)
at
org.apache.wicket.spring.SpringBeanLocator.getBeanName(SpringBeanLocator.java:195)
at
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:135)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:92)
at org.apache.wicket.injection.Injector.inject(Injector.java:108)
On Sun, May 31, 2009 at 10:47 PM, Vasu Srinivasan <[email protected]> wrote:
> Have you tried like this:
> @SpringBean(name = "xServiceImpl") XService xservice;
>
>
>
> On Sun, May 31, 2009 at 5:03 PM, Igor Vaynberg <[email protected]
> >wrote:
>
> > wicket is looking for these beans in the spring context. if spring is
> > not putting those beans there then it will be a problem.
> >
> > -igor
> >
> > On Sun, May 31, 2009 at 2:19 PM, Luther Baker <[email protected]>
> > wrote:
> > > 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]
> > >>
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
> --
> Regards,
> Vasu Srinivasan
>