本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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]");
}
示例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();
}
}
示例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();
}
示例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);
}
}
示例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();
}
}
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}