You cannot use "new" to create a spring bean in you HomePage class.
You must use @SpringBean on "ClsDb"

Kristian


2013/9/26 dan123 <c...@email.cz>:
> Hi,
> I have simple project created from Quickstart, and I have deffined in
> springContext.xml bean named "dbAccess".
> When I use: *@SpringBean private DbAccess dbAccess;* in *class HomePage
> extends WebPage*.
> It works, it creates bean and in constructor "HomePage" class I can access
> to dbAccess.
>
> But when I create class with one method:
> public class ClsDb {
> @Autowired private DbAccess dbAccess;
> public void save() {
>  // ... dbAccess.... save something
> }
> }
>
> and in HomePage class I use "new ClsDb().save();", "dbAccess" in ClsDb is
> null.
>
> What is neccessary to do for use @Autowired in ClsDb class?
> Thanks.
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/wicket-autowired-annotation-tp4661529.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to