[weld-dev] [cdi-dev] Problem with EJB´s, Stereotype with an @Alternative and Specialization

Pete Muir pmuir at redhat.com
Tue Oct 9 22:24:02 EDT 2012


This looks like purely an impl issue, moving to weld-dev.

On 9 Oct 2012, at 12:56, Daniel Sachse wrote:

> Hey guys,
> 
> I ran into a problem today and I am unsure if the behavior I encountered is the way it should be.
> 
> My Environment:
> JBoss 7.1.1.Final with Weld 1.1.5
> 
> My Scenario:
> 
> ------------------------------------------------------------------------------------------------------
> public abstract class AbstractClass implements DemoInterface {…}
> 
> @Singleton
> @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
> public class Real extends AbstractClass {…}
> 
> @Singleton
> @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
> @Alternative
> @Specializes
> public class Mock extends Real {…}
> 
> ------------------------------------------------------------------------------------------------------
> 
> If I register class Mock as an @Alternative in beans.xml, everything works fine.
> 
> <alternatives>
> 	<class>at.w0mb.example.Mock</class>
> </alternatives>
> 
> As soon as I try:
> 
> ------------------------------------------------------------------------------------------------------
> 
> @Alternative
> @Stereotype
> @Retention(RUNTIME)
> @Target(TYPE)
> public @interface Mock {}
> 
> 
> @Singleton
> @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
> @Mock
> //@Alternative
> @Specializes
> public class Mock extends Real {…}
> 
> ------------------------------------------------------------------------------------------------------
> 
> If I now register the @Stereotype Mock as an @Alternative in beans.xml, the application won´t deploy.
> <alternatives>
> 	<stereotype>at.w0mb.example.stereotype.Mock</stereotype>
> </alternatives>
> 
> The thrown error message is:
> 	WELD-001408 Unsatisfied dependencies for type [DemoInterface] …….
> 
> 
> Do you guys think that this is normal? Is it a specification Issue? Or Weld?
> 
> Regards,
> 
> Daniel
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev




More information about the weld-dev mailing list