You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Felix Gonschorek <fe...@gmail.com> on 2010/11/22 20:57:29 UTC

[T5.2.4] Service ambiguity does not get resolved, when Marker annotations are defined inside of an service implementation

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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.2.4] Service ambiguity does not get resolved, when Marker annotations are defined inside of an service implementation

Posted by Kalle Korhonen <ka...@gmail.com>.
I think you are right. Easy way out is to add
withMarker(...).preventReloading();

Service reloading enabled by default can be frustrating when you hit
issues, but overall I think the benefits outweigh the harms.

Kalle


On Mon, Nov 22, 2010 at 11:57 AM, Felix Gonschorek
<fe...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: [T5.2.4] Service ambiguity does not get resolved, when Marker annotations are defined inside of an service implementation

Posted by Howard Lewis Ship <hl...@gmail.com>.
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.gonschorek@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@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