Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2240

Producer method without any scope doesn't fall back to @Dependent

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Rejected
    • Affects Version/s: 2.3.5.Final
    • Fix Version/s: None
    • Component/s: Scopes & Contexts
    • Labels:
      None

      Description

      When beans.xml contains bean-discovery-mode="annotated" then:

        public class SomeFactory {
            @Produces
            public SomeClass someClass() {
                return new SomeClass();
            }
        }
      

      doesn't register SomeClass with a @Dependent scope.
      Weld forces me to add some scope annotation: @ApplicationScoped, @SessionScoped, @RequestScoped, @Dependent. CDI spec 3.3 Producer methods has examples without any scope annotations, so I guess it should be possible in Weld.

      Expected behaviour: occurrence of `@Produces` annotation on a method should cause the returned class to be a default-scoped bean.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gdemecki Grzegorz Demecki
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: