Uploaded image for project: 'PicketLink'
  1. PicketLink
  2. PLINK-633

Make social module jar usable in a CDI application

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • PLINK_2.7.0.CR3
    • PLINK_2.7.0.CR2
    • SOCIAL

      When picketlink-social jar is on classpath of a CDI application and one tries to inject built-in Principal bean like this:

      @Inject
      private Principal principal;

      the error message is

      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

      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.

              psilva@redhat.com Pedro Igor Craveiro
              marcin-caban Marcin Caban (Inactive)
              Pedro Igor Craveiro
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: