I think a replacement like @InjectServiceId would be quite helpful.
On Fri, May 21, 2010 at 9:56 PM, Howard Lewis Ship <[email protected]> wrote:
> One of the stumbling blocks people hit continually is injection into
> services. Often people want to inject strings, say:
>
> public class MyServiceImpl implements MyService {
>
> public MyServiceImpl(@Value("${email}") emailAddress, ...)
>
>
> What do they get? emailAddress gets "MyService", the service's unique id.
>
> This Seemed Like A Good Idea At The Time, but its very rare that a
> service needs to know its service id and that's always available by
> injecting ServiceResources and invoking getServiceId().
>
> To make this work, you have to add an @Inject annotation; even I
> forget that occasionally.
>
> I think it would be a good idea to turn that off. The likelyhood of it
> breaking anyone's code is pretty limited; except in the rare case that
> a service implementation does want its service id, this will work. If
> the @Inject is present, it will do no harm.
>
> Obviously, this will require some minor doc changes.
>
> Thoughts?
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Best regards,
Igor Drobiazko
http://tapestry5.de/blog