tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject [DISCUSS] Remove auto-inject of String as service id
Date Fri, 21 May 2010 19:56:45 GMT
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.


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

To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org

View raw message