You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Korbinian Bachl <ko...@whiskyworld.de> on 2007/12/17 16:12:07 UTC

Wicket-Spring RC2/ Spring 2.5 Annot problem/ Bug?

Hi,

i get

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean 
named 'foo' is defined

when defining a Bean like this:

@Component("foo")
public class someDAO {...

and in XML:
<context:component-scan base-package="de.company" />
<context:annotation-config />

while if defining that way:

public class someDAO {...

XML:
<bean id="foo" class="de.company.path.persistence.access.someDAO" />

works.

Wicket Java is:
public class Index extends WebPage {

     @SpringBean(name="foo")
     private someDAO dao;

     public Index() {
         add(new Label("hw", "Hello World! - Im from Wicket!"));
         System.out.println(dao.toString());
     }

}

Did I do something wrong here or can it be that SpringBean doesnt work 
with annotation configured spring beans?

Best,

Korbinian



Re: Wicket-Spring RC2/ Spring 2.5 Annot problem/ Bug?

Posted by Korbinian Bachl <ko...@whiskyworld.de>.
Hello Timo,

i finally found the out the reasonwhy it didnt work and that was a 
mistake by me by wrongly configuring the scan.

Im now nearly through the book "Spring 2" and see things a bit more 
clearly now as well as now know how to have spring telling me what it 
does :)

Best + happy new year,

Korbinian

Timo Rantalaiho schrieb:
> On Mon, 17 Dec 2007, Korbinian Bachl wrote:
>> Did I do something wrong here or can it be that SpringBean doesnt work 
>> with annotation configured spring beans?
> 
> It does, there must be some other Spring configuration error.
> You're better off testing the Spring configuration in Spring-
> only integration tests and only when your ApplicationContext 
> is OK and contains your beansstart tying it to Wicket.
> 
> Best wishes,
> Timo
> 

Re: Wicket-Spring RC2/ Spring 2.5 Annot problem/ Bug?

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 17 Dec 2007, Korbinian Bachl wrote:
> Did I do something wrong here or can it be that SpringBean doesnt work 
> with annotation configured spring beans?

It does, there must be some other Spring configuration error.
You're better off testing the Spring configuration in Spring-
only integration tests and only when your ApplicationContext 
is OK and contains your beansstart tying it to Wicket.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >