org.jboss.weld.environment.se.Weld.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中org.jboss.weld.environment.se.Weld.<init>()方法的一些代码示例,展示了Weld.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Weld.<init>()方法的具体详情如下:
包路径:org.jboss.weld.environment.se.Weld
类名称:Weld
方法名:<init>

Weld.<init>介绍

暂无

代码示例

代码示例来源:origin: cucumber/cucumber-jvm

protected void start(Weld weld) {
  try {
    if (weld == null) {
      weld = new Weld();
    }
    containerInstance = weld.initialize();
  } catch (IllegalArgumentException e) {
    throw new CucumberException(START_EXCEPTION_MESSAGE, e);
  }
}

代码示例来源:origin: jersey/jersey

public static void main(String[] args) {
  try {
    System.out.println("\"Hello World\" Jersey Example Weld App");
    final Weld weld = new Weld();
    weld.initialize();
    final ResourceConfig resourceConfig = createJaxRsApp();
    final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, resourceConfig, false);
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
      @Override
      public void run() {
        server.shutdownNow();
        weld.shutdown();
      }
    }));
    server.start();
    System.out.println(String.format("Application started.\nTry out %s%s\nStop the application using CTRL+C",
        BASE_URI, ROOT_PATH));
    Thread.currentThread().join();
  } catch (IOException | InterruptedException ex) {
    Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
  }
}

代码示例来源:origin: jersey/jersey

protected static void start() {
  weld = new Weld();
  weld.initialize();
  server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, createJaxRsApp(), true);
}

代码示例来源:origin: stackoverflow.com

public class WebServiceBinder extends AbstractBinder {

 @Override
 protected void configure() {
  BeanManager bm = getBeanManager();
  bind(getBean(bm, StudentRepository.class))
    .to(StudentRepository.class);
 }

 private BeanManager getBeanManager() {
  // is there a better way to get the bean manager?
  return new Weld().getBeanManager();
 }

 private <T> T getBean(BeanManager bm, Class<T> clazz) {
  Bean<T> bean = (Bean<T>) bm.getBeans(clazz).iterator().next();
  CreationalContext<T> ctx = bm.createCreationalContext(bean);
  return (T) bm.getReference(bean, clazz, ctx); 
 }
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws Exception {
  Weld weld = new Weld();
  final WeldContainer container = weld.initialize();
  RequestContext requestContext= container.instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get();
    requestContext.activate();

  final MyPojo pojo = container.instance().select(MyPojo.class).get();

  Thread t = new Thread() {
    public void run() {
      RequestContext requestContext= container.instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get();
      requestContext.activate();
      System.out.println("1" + pojo.ping()); 
    }
  };
  t.start();
  t.join();
  System.out.println("2" + pojo.ping());
  weld.shutdown();

}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws IOException {
  Weld weld = new Weld();
  WeldContainer container = weld.initialize();
  Application application = container.instance().select(Application.class).get();
  application.run();
  weld.shutdown();
}

代码示例来源:origin: org.guvnor/guvnor-test-utils

private void startWeld() {
  logger.debug("Starting Weld for test class " + testClass.getCanonicalName());
  weld = new Weld(testClass.getCanonicalName());
  weldContainer = weld.initialize();
}

代码示例来源:origin: com.ibm.jbatch/com.ibm.jbatch.container

@Override
public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
  weld = new Weld();
  container = weld.initialize();
}

代码示例来源:origin: CDISource/cdisource

@Override
protected void doStart() throws Exception {
  weld = new Weld();
  delegate = weld.initialize();
}

代码示例来源:origin: apache/deltaspike

@Override
public synchronized void boot()
{
  weld = new Weld();
  weldContainer = weld.initialize();
}

代码示例来源:origin: io.squark.yggdrasil.yggdrasil-framework-provider/yggdrasil-cdi-provider

@Override
public void provide(YggdrasilConfiguration configuration) throws YggdrasilException {
  logger.info("Initializing Weld container...");
  System.setProperty("org.jboss.logging.provider", "slf4j");
  Weld weld = new Weld();
  weld.property(Weld.ARCHIVE_ISOLATION_SYSTEM_PROPERTY, false);
  weld.setClassLoader(CDIProvider.class.getClassLoader());
  WeldContainer container = weld.initialize();
  YggdrasilContext.registerObject(BeanManager.class.getName(), container.getBeanManager());
  logger.info(CDIProvider.class.getSimpleName() + " initialized.");
}

代码示例来源:origin: org.kie/kie-config-cli

public static CliContext buildContext(InputReader input) {
  
  Weld weld = new Weld();
  WeldContainer container = weld.initialize();
  
  CliContext context = new CliContext(weld, container, input);
  
  return context;
}

代码示例来源:origin: stackoverflow.com

Weld weld = new Weld();
WeldContainer container = weld.initialize();
World helloWorld = container.instance().select(World.class).get();
System.out.println(helloWorld.helloWorld());
weld.shutdown();

代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq

public static void main(String[] args) {
  try {
    Weld weld = new Weld();
    WeldContainer container = weld.initialize();
    Fabric8MQ fabric8MQ = container.instance().select(Fabric8MQ.class).get();
    fabric8MQ.start();
    waitUntilStop();
  } catch (Throwable e) {
    e.printStackTrace();
    LOG.error("Failed to Start Fabric8-MQ", e);
  }
}

代码示例来源:origin: org.uberfire/uberfire-test-utils

public void setUp() throws Exception {
    // Bootstrap WELD container
    weld = new Weld();
    WeldContainer weldContainer = weld.initialize();
    beanManager = weldContainer.getBeanManager();

    // Instantiate Paths used in tests for Path conversion
    paths = getReference(Paths.class);

    // Ensure URLs use the default:// scheme
//        fileSystemProvider.forceAsDefault();
  }

代码示例来源:origin: org.jbpm/jbpm-human-task-services

private TaskServiceModule() {
  weld = new Weld();
  this.container = weld.initialize();
  
  this.taskService = this.container.instance().select(TaskServiceEntryPointImpl.class).get();
  //Singleton.. that we need to instantiate
  this.container.instance().select(TaskLifeCycleEventListener.class).get(); 
}

代码示例来源:origin: liimaorg/liima

public WeldJUnit4Runner(final Class<Object> klass)
    throws InitializationError {
  super(klass);
  this.klass = klass;
  this.weld = new Weld();
  this.container = weld.initialize();
}

代码示例来源:origin: org.jboss.weld/weld-junit-common

/**
 * The returned {@link Weld} instance has:
 * <ul>
 * <li>automatic discovery disabled</li>
 * <li>concurrent deployment disabled</li>
 * </ul>
 *
 * @return a new {@link Weld} instance suitable for testing
 */
public static Weld createWeld() {
  return new Weld().disableDiscovery().property(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), false);
}

代码示例来源:origin: stackoverflow.com

// Initialize Weld
 Weld theWeld = new Weld();
 WeldContainer theContainer = theWeld.initialize();
 // Execute the run method
 theContainer.instance().select(Main.class).get().run();
 // Shutting down Weld again
 theWeld.shutdown();

代码示例来源:origin: apache/cxf

@Before
public void setUp() {
  final Weld weld = new Weld();
  container = weld.initialize();
  bus = getBeanReference(Bus.class);
}

相关文章