I would document this as a "gotcha". The idea of putting the marker annotation right in the service implementation class seems odd ... it ends up creating a binding from the clients of the service to the implementation, which can't be moved, renamed, or have its visibility changed without breaking those clients. With a top-level annotation, rather than a nested, inner class annotation, that problem goes away (just the marker annotation has to be stable, not the service implementation class).
On Mon, Nov 22, 2010 at 11:57 AM, Felix Gonschorek < felix.gonscho...@gmail.com> wrote: > hi all, > > we are currently in progress to migrate our application from tapestry > 5.1.0.5 to > tapestry 5.2.4 - we encounter some minor challenges, but the following was > hard > to solve: > > In Tapestry 5.2.4 a service with a single interface and multiple > implemenations > which are discriminated with an marker annotation get not resolved when the > marker annotation is defined inside a service implementation: > > binder.bind(AddressValidationStrategy.class, > > NoChecksAddressValidationStrategy.class).withId(Invoice.class.getName()).withMarker(Invoice.class); > binder.bind(AddressValidationStrategy.class, > > DefaultAddressValidationStrategy.class).withId(Shipping.class.getName()).withMarker(Shipping.class); > > > The marker "Invoice.class" and "Shipping.class" (which are annotations) are > defined within another service. This service uses both > AddressValidationStrategies. > > While writing this message i am getting an assumption why this error > occurs: Its > because of the live class reloading of the service implementations. > > When definging the annotations in a separate java file outside of the > service > implementation, the services get resolved. > > i don't know if this is an error or bad design to define the annotations > inside > of an service implemenation, but maybe one should add a hint to the api of > the > servicebinder methods, that the marker annotations need to be defined in > separate java files or at least not as a member of a service > implementation. > > keep up the good work, > > felix< > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- 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