When picketlink-social jar is on classpath of a CDI application and one tries to inject built-in Principal bean like this:
{quote} @Inject private Principal principal; {quote}
the error message is
{quote} Ambiguous dependencies for type Principal with qualifiers @Default Possible dependencies: Built-in Bean java.security.Principal with qualifiers @Default, Managed Bean class org.picketlink.social.standalone.fb.FacebookPrincipal with qualifiers @Any @Default {quote}
Looks like FacebookPrincipal is not meant to be a CDI bean and is not injected anywhere else.
Possible solutions: 1. Exclude this class explicitly in beans.xml 2. Annotate it as @Vetoed - same effect as above but a compile time dependency on CDI required. 3. Pedro's idea: annotate it with custom @PicketLink qualifier. 4. My recent idea: Since CDI is not used in this module at all, to replace CDI 1.0 beans.xml with CDI 1.1 version with bean-discovery-mode="annotated" or "none". I'm not sure how CDI 1.0 container behaves then. Probably will still scan the archive as beans.xml is present.
|