本文整理汇总了Java中org.wildfly.swarm.undertow.WARArchive.addPackage方法的典型用法代码示例。如果您正苦于以下问题:Java WARArchive.addPackage方法的具体用法?Java WARArchive.addPackage怎么用?Java WARArchive.addPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wildfly.swarm.undertow.WARArchive
的用法示例。
在下文中一共展示了WARArchive.addPackage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// Instantiate the container
Swarm swarm = new Swarm(args);
// Create one or more deployments
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
// Add resource to deployment
deployment.addPackage(Main.class.getPackage());
deployment.addAllDependencies();
// Add Web resources
deployment.addAsWebResource(
new ClassLoaderAsset("src/main/webapp/index.html", Main.class.getClassLoader()), "src/main/webapp/index.html");
deployment.addAsWebInfResource(
new ClassLoaderAsset("src/main/webapp/WEB-INF/beans.xml", Main.class.getClassLoader()), "beans.xml");
swarm.start().deploy(deployment);
}
示例2: createDeployment
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Deployment
public static Archive createDeployment() throws Exception {
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
// on real world deployments, these parts would come from a dependency of the target application
deployment.addClass(MockTracerResolver.class);
deployment.addPackage(MockTracer.class.getPackage());
deployment.addAsServiceProvider(TracerResolver.class, MockTracerResolver.class);
// this is a simple servlet, that we can hit with our tests
deployment.addClass(SimpleServlet.class);
deployment.addClass(HealthServlet.class);
deployment.addAsResource("project-skip-pattern.yml");
return deployment;
}
示例3: createDeployment
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Deployment(testable = false)
public static Archive<?> createDeployment() throws Exception {
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
deployment.addPackage("pro.taskana");
deployment.addClass(TaskanaProducers.class);
deployment.addAllDependencies();
deployment.addDependency("org.mybatis:mybatis:3.4.2");
deployment.addDependency("org.mybatis:mybatis-cdi:1.0.0");
deployment.addDependency("pro.taskana:taskana-core:0.0.5-SNAPSHOT");
deployment.addAsResource("META-INF/beans.xml");
deployment.addAsResource("taskana.properties");
deployment.addAsResource("project-defaults.yml");
return deployment;
}
示例4: main
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// Instantiate the container
Swarm swarm = new Swarm(args);
// Create one or more deployments
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
// Add resource to deployment
deployment.addPackage(Main.class.getPackage());
deployment.addAllDependencies();
// Add Web resources
deployment.addAsWebResource(
new ClassLoaderAsset("index.html", Main.class.getClassLoader()), "index.html");
deployment.addAsWebInfResource(
new ClassLoaderAsset("WEB-INF/web.xml", Main.class.getClassLoader()), "web.xml");
deployment.addAsWebInfResource(
new ClassLoaderAsset("WEB-INF/beans.xml", Main.class.getClassLoader()), "beans.xml");
// If There's a KEYCLOAK_SERVER_URL env var, then read the file
if (System.getenv("KEYCLOAK_AUTH_SERVER_URL") != null) {
deployment.addAsWebInfResource(
new ClassLoaderAsset("keycloak.json", Main.class.getClassLoader()), "keycloak.json");
}
swarm.start().deploy(deployment);
}
示例5: createDeployment
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Deployment
public static Archive createDeployment() throws Exception {
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
// on real world deployments, these parts would come from a dependency of the target application
deployment.addClass(MockTracerResolver.class);
deployment.addPackage(MockTracer.class.getPackage());
deployment.addAsServiceProvider(TracerResolver.class, MockTracerResolver.class);
// this is a simple servlet, that we can hit with our tests
deployment.addClass(SimpleServlet.class);
return deployment;
}
示例6: createDeployment
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Deployment
public static Archive createDeployment() throws Exception {
WARArchive archive = ShrinkWrap.create(WARArchive.class, "SampleTest.war");
archive.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
archive.addPackage("example");
archive.addAllDependencies();
return archive;
}
示例7: main
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Container container = new Container();
container.fraction(new DatasourcesFraction().jdbcDriver("h2", (d) -> {
d.driverDatasourceClassName("org.h2.Driver");
d.xaDatasourceClass("org.h2.jdbcx.JdbcDataSource");
d.driverModuleName("com.h2database.h2");
}).dataSource("ExampleDS", (ds) -> {
ds.driverName("h2");
ds.connectionUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
ds.userName("sa");
ds.password("sa");
}));
container.fraction(new JPAFraction().inhibitDefaultDatasource().defaultDatasource("jboss/datasources/ExampleDS"));
container.start();
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
deployment.addClasses(BlogEntryDao.class, BlogEntryQueryImpl.class, BlogEntry.class);
deployment.addPackage(BlogEntryBean.class.getPackage());
deployment.addAllDependencies();
deployment.addAsWebResource(new ClassLoaderAsset("index.xhtml", Main.class.getClassLoader()), "index.xhtml");
deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence.xml", Main.class.getClassLoader()),
"classes/META-INF/persistence.xml");
deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/load.sql", Main.class.getClassLoader()), "classes/META-INF/load.sql");
deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/beans.xml", Main.class.getClassLoader()), "classes/META-INF/beans.xml");
container.deploy(deployment);
}