當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。