atom feed10 messages in org.apache.tapestry.dev[DISCUSS] Remove auto-inject of Strin...
FromSent OnAttachments
Howard Lewis ShipMay 21, 2010 12:56 pm 
Thiago H. de Paula FigueiredoMay 21, 2010 1:19 pm 
Igor DrobiazkoMay 21, 2010 1:26 pm 
Thiago H. de Paula FigueiredoMay 21, 2010 2:26 pm 
Igor DrobiazkoMay 21, 2010 2:48 pm 
Igor DrobiazkoMay 21, 2010 2:49 pm 
Thiago H. de Paula FigueiredoMay 21, 2010 2:50 pm 
Igor DrobiazkoMay 21, 2010 3:00 pm 
Robert ZeiglerMay 24, 2010 5:10 am 
Massimo LusettiMay 25, 2010 1:02 am 
Subject:[DISCUSS] Remove auto-inject of String as service id
From:Howard Lewis Ship (hls@gmail.com)
Date:May 21, 2010 12:56:22 pm
List:org.apache.tapestry.dev

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