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

Expose BeanBuilder in Weld builder

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 3.0.0.Alpha9
    • None
    • Java SE Support
    • None

    Description

      Often there will be existing state (e.g. configuration) when starting embedded Weld. There should be an easy way to register a producer for this state. It is currently possible to add an extension and register a producer using the new BeanBuilder API but it requires a lot of boilerplate code. Ideally, we could support something like:

      final Client client = new JerseyClientBuilder(env).using(conf.getJerseyClientConfiguration()).build(getName());
      
      Weld builder = new Weld().disableDiscovery().addPackage(false, Main.class);
      builder.addBean().addType(Client.class).produceWith(() -> client).disposeWith(c -> c.close()).addQualifier(DefaultLiteral.INSTANCE)
      WeldContainer weld = builder.initialize()
      

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            rhn-engineering-jharting Jozef Hartinger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: