Your SomeService should have a constructor that takes your SomeDAO as a
parameter.  You shouldn't even need to use @Inject.

public class SomeClass{

  private final SomeDAO dao;

  public SomeClass(SomeDao dao){
    this.dao=dao;
  }
}

Then using bind() should take care of the injection for you.  If you want
more control, you could use a builder method.


On Thu, May 5, 2011 at 11:40 AM, LLTYK <ll...@mailinator.com> wrote:

> So I have a DAO, with an interface and impl, and injecting it works fine in
> a
> page:
>
> public class SomePage
> {
>  @Inject
>  private SomeDAO someDAO;
> }
>
>
>
> But then I have some tapestry service:
>
> public class SomeService
> {
>  @Inject
>  private SomeDAO someDAO; //nope
>  @Inject @Autowired
>  private SomeDAO someDAO; //nope
>  @Autowired
>  private SomeDAO someDAO; //nope
> }
>
>
>
> So how do I inject spring beans in services?
>
> --
> View this message in context:
> http://tapestry-users.832.n2.nabble.com/Injecting-spring-beans-in-tapestry-services-tp6334659p6334659.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Jonathan Barker
ITStrategic

Reply via email to