Re: Injecting spring beans in tapestry services?

2011-05-05 Thread LLTYK
Well the real problem was me trying to use the service to early during
application startup.

A plain
  @Inject
  private SomeDAO someDAO;


worked after I moved my code to contributeRegistryStartup.

--
View this message in context: 
http://tapestry-users.832.n2.nabble.com/Injecting-spring-beans-in-tapestry-services-tp6334659p6335087.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



Re: Injecting spring beans in tapestry services?

2011-05-05 Thread LLTYK
Why does it work in pages anyways, if they're not exposed as ioc services
without compatibility mode?

--
View this message in context: 
http://tapestry-users.832.n2.nabble.com/Injecting-spring-beans-in-tapestry-services-tp6334659p6334823.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



Re: Injecting spring beans in tapestry services?

2011-05-05 Thread LLTYK

public SomeService(SomeDAO someDAO)
{
  this.someDAO = someDAO; //nope
}

Still getting "No service implements the interface".



Thiago, that would turn off injecting tapestry services into spring beans.
I'm gonna hold out for a bit.



--
View this message in context: 
http://tapestry-users.832.n2.nabble.com/Injecting-spring-beans-in-tapestry-services-tp6334659p6334803.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



Re: Injecting spring beans in tapestry services?

2011-05-05 Thread Jonathan Barker
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  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


Re: Injecting spring beans in tapestry services?

2011-05-05 Thread Thiago H. de Paula Figueiredo

On Thu, 05 May 2011 12:40:51 -0300, LLTYK  wrote:


So how do I inject spring beans in services?


Just use the Tapestry 5.0 compatibility mode. Chech the tapestry-spring  
documentation.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Injecting spring beans in tapestry services?

2011-05-05 Thread LLTYK
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