当前位置: 首页>>代码示例>>Java>>正文


Java Weld.initialize方法代码示例

本文整理汇总了Java中org.jboss.weld.environment.se.Weld.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java Weld.initialize方法的具体用法?Java Weld.initialize怎么用?Java Weld.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.weld.environment.se.Weld的用法示例。


在下文中一共展示了Weld.initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initWeldContainer

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
protected WeldContainer initWeldContainer(Weld weld) {
    // Register mock injection services if needed
    if (!resources.isEmpty()) {
        weld.addServices(new MockResourceInjectionServices(resources));
    }
    if (ejbFactory != null) {
        weld.addServices(new MockEjbInjectionServices(ejbFactory));
    }
    if (persistenceContextFactory != null || persistenceUnitFactory != null) {
        weld.addServices(new MockJpaInjectionServices(persistenceUnitFactory, persistenceContextFactory));
    }
    // Init the container
    container = weld.initialize();
    injectInstances();
    if (extension != null) {
        extension.activateContexts();
    }
    return container;
}
 
开发者ID:weld,项目名称:weld-junit,代码行数:20,代码来源:AbstractWeldInitiator.java

示例2: start

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Override
public void start(Stage initStage) throws Exception {
    final Stage primaryStage = new Stage(StageStyle.DECORATED);
    Task<ObservableValue<Stage>> mainStageTask = new Task<ObservableValue<Stage>>() {
        @Override
        protected ObservableValue<Stage> call() throws Exception {
            Weld weld = new Weld();
            WeldContainer container = weld.initialize(); // Initialize Weld CDI
            primaryStage.setTitle("StudyGuide");
            primaryStage.setOnCloseRequest(event -> {
                logger.debug("Closing down Weld.");
                weld.shutdown();
            });
            primaryStage.getIcons().add(new Image(StudyGuideApplication.class.getResourceAsStream(logoResource)));
            container.event().select(Stage.class, new AnnotationLiteral<StartupStage>() {
            }).fire(primaryStage);
            return new ReadOnlyObjectWrapper<>(primaryStage);
        }
    };
    mainStageTask.exceptionProperty().addListener((observable, oldValue, newValue) -> {
        Platform.runLater(() -> {
            throw new IllegalStateException("Main stage loading failed.", newValue);
        });
    });
    showSplashScreen(initStage, mainStageTask);
}
 
开发者ID:oskopek,项目名称:StudyGuide,代码行数:27,代码来源:StudyGuideApplication.java

示例3: testInit

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Test
public void testInit() throws InterruptedException {
    /**
     * Some TODOs:
     *
     * 1. Add an extension that observes ProcessAnnotatedType, keeps in a class, and then add a getter to get the list of these that are annotated @Path
     * 2. Override CDIRequestDispatcher to start a request context, and then stop when done.
     *
     */
    BasicConfigurator.configure();
    Weld weld = new Weld();
    weld.initialize();
    LoadPathsExtension paths = CDI.current().select(LoadPathsExtension.class).get();
    CDINettyJaxrsServer netty = new CDINettyJaxrsServer();
    ResteasyDeployment rd = new ResteasyDeployment();
    rd.setActualResourceClasses(paths.getResources());
    rd.setInjectorFactoryClass(CdiInjectorFactory.class.getName());
    netty.setDeployment(rd);
    netty.setPort(8087);
    netty.setRootResourcePath("");
    netty.setSecurityDomain(null);
    netty.start();
    Client c = ClientBuilder.newClient();
    String result = c.target("http://localhost:8087").path("/").request("text/plain").accept("text/plain").get(String.class);
    Assert.assertEquals("pong", result);
}
 
开发者ID:johnament,项目名称:resteasy-netty-cdi,代码行数:27,代码来源:NettyTest.java

示例4: start

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
public void start() throws Exception {
	logger.log(Level.INFO, "stokesdrift:server:start[status=in_progress]");

	logger.log(Level.INFO, "stokesdrift:server:load_cdi_container[status=in_progress]");
	weld = new Weld();
	container = weld.initialize();
	logger.log(Level.INFO, "stokesdrift:server:load_cdi_container[status=complete]");

	applications = loadApplicationDefinitions(config);

	Undertow.Builder builder = Undertow.builder().addHttpListener(config.getPort(), config.getHost());
	List<DeploymentManager> managers = deployApplications(applications);
	for (DeploymentManager deploymentManager : managers) {
		builder.setHandler(deploymentManager.start());
	}
	server = builder.build();
	server.start();
	logger.log(Level.INFO, "stokesdrift:server:http[port="+config.getPort()+",host="+config.getHost()+"]");
	logger.log(Level.INFO, "stokesdrift:server:start[status=complete]");
}
 
开发者ID:stokesdrift,项目名称:stokesdrift,代码行数:21,代码来源:Server.java

示例5: run

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
public void run(GeneratorTrigger context) throws IOException {
	Weld weld = new Weld();
	try {
		weld.setClassLoader(context.getClassLoader());
		weld.initialize();

		CrnkBoot boot = new CrnkBoot();
		boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://<generator>"));
		boot.boot();

		ModuleRegistry moduleRegistry = boot.getModuleRegistry();
		Optional<MetaModule> optionalModule = moduleRegistry.getModule(MetaModule.class);

		if (!optionalModule.isPresent()) {
			throw new IllegalStateException(
					"add MetaModule to CDI setup, got: " + moduleRegistry.getModules() + " with " + boot
							.getServiceDiscovery());
		}

		MetaModule metaModule = optionalModule.get();
		MetaLookup lookup = metaModule.getLookup();
		context.generate(lookup);
	}
	finally {
		weld.shutdown();
	}

}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:29,代码来源:CdiRunner.java

示例6: main

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Weld weld = new Weld();
    WeldContainer container = weld.initialize();

    TextUI textUI = container.instance().select(TextUI.class).get();
    printBanner();
    textUI.start();
}
 
开发者ID:redhat-italy,项目名称:hacep,代码行数:9,代码来源:Main.java

示例7: bootstrapWeldContainer

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Test
public void bootstrapWeldContainer() {
    Weld weld = new Weld();

    try (WeldContainer container = weld.initialize()) {
        Greeter greeter = container.select(Greeter.class).get();
        assertTrue(greeter != null);
    }
}
 
开发者ID:hantsy,项目名称:ee8-sandbox,代码行数:10,代码来源:GreeterTest.java

示例8: execute

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
  if (System.getProperty(SYSPROP_PRINT_WF) != null) {
    WorkflowUtil.printWorkflow(getGoalName(), getPluginDescriptor(), Optional.fromNullable(this.workflowDescriptor),
        createLogWrapper());
    return;
  }

  System.setProperty("org.jboss.logging.provider", "slf4j");
  String logLevel = "info";
  if (getLog().isDebugEnabled()) {
    logLevel = "debug";
  }
  System.setProperty("org.slf4j.simpleLogger.log.org.jboss.weld", logLevel);

  Weld weld = new Weld();
  weld.addExtension(this);
  addPluginDependencies(weld);
  WeldContainer weldContainer = null;
  try {
    weldContainer = weld.initialize();
    if (System.getProperty(SYSPROP_PRINT_STEPS) != null) {
      WorkflowUtil.printAvailableSteps(this.allAvailableProcessingSteps, createLogWrapper());
      return;
    }

    WorkflowUtil.addExecutionContexts(getWorkflow());
    Map<String, CDIMojoProcessingStep> processingSteps = getAllProcessingSteps(weldContainer);

    PluginParameterExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(this._session,
        this._mojoExecution);
    WorkflowExecutor executor = new WorkflowExecutor(getWorkflow(), processingSteps, getLog(), expressionEvaluator);
    executor.validate(!this._settings.isOffline());
    executor.execute();
  } finally {
    if (weldContainer != null && weldContainer.isRunning()) {
      weldContainer.shutdown();
    }
  }
}
 
开发者ID:shillner,项目名称:maven-cdi-plugin-utils,代码行数:41,代码来源:AbstractCDIMojo.java

示例9: RequestHandler

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
public RequestHandler() {

		Weld weld = new Weld();
		weld.initialize();

		// configure the application with the resource
		ResourceConfig resourceConfig = new ResourceConfig()
				.register(GatewayFeature.class)
				.packages("com.jrestless.aws.examples");
		init(resourceConfig);
		start();
	}
 
开发者ID:bbilger,项目名称:jrestless-examples,代码行数:13,代码来源:RequestHandler.java

示例10: setup

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Before
public void setup() {
	Weld weld = new Weld();
	WeldContainer container = weld.initialize();
	WeldComponentStinger stinger = new WeldComponentStinger(container);
	stinger.bind(this);
}
 
开发者ID:danjee,项目名称:hedgehog,代码行数:8,代码来源:TestHedgehogWeld.java

示例11: main

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
public static void main(String[] args) {
    //Boostrap the CDI container, in this case WELD
    Weld w = new Weld();

    WeldContainer wc = w.initialize();
    App app = wc.instance().select(App.class).get();
    app.bootstrapDrools();

    w.shutdown();
}
 
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:11,代码来源:App.java

示例12: setUp

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  // set the process engine in the TestProcessEngineLookup-bean.
  ProcessEngineLookupForTestsuite.processEngine = processEngine;
  // bootstrap the CDI container
  weld = new Weld();
  weldContainer = weld.initialize();
  beanManager = weldContainer.getBeanManager();
  BeanManagerLookup.localInstance = beanManager;
  
  beginRequest();
  beginSession();
  beginConversation();    
  
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:16,代码来源:CdiActivitiTestCase.java

示例13: setUp

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
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();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:13,代码来源:CDITestSetup.java

示例14: setupWeld

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
@Setup
public void setupWeld() {
    myWeld = new Weld();
    container = myWeld.initialize();
    myAS = getBean(MyASInterface.class);
    myASE = getBean(MyASEInterface.class);
    mySingleton = getBean(MySingletonInterface.class);
    myDependent = getBean(MyDependentInterface.class);
    myDefault = getBean(MyDefaultInterface.class);
    myException = getBean(MySingletonExceptionInterface.class);
}
 
开发者ID:jpaw,项目名称:jdp,代码行数:12,代码来源:WeldBench.java

示例15: main

import org.jboss.weld.environment.se.Weld; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

        Weld weld = new Weld();
        WeldContainer container = weld.initialize();
        PlaygroundConfiguration conf = container.instance().select(PlaygroundConfiguration.class).get();
        conf.build();

        TextUI textUI = container.instance().select(TextUI.class).get();
        printBanner();
        textUI.start();

    }
 
开发者ID:redhat-italy,项目名称:jdg-quickstarts,代码行数:13,代码来源:PlaygroundMain.java


注:本文中的org.jboss.weld.environment.se.Weld.initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。