官术网_书友最值得收藏!

Adapting to WildFly Swarm

Now we all know how to create Java EE applications, described previously, but we are here to learn how to use WildFly Swarm, so let's adopt the preceding application for it. Let's roll up our sleeves as we have some hard work to do now.

We have to modify pom.xml:

(...)

<dependencies>
<!-- 1 -->
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs</artifactId>
<version>${version.wildfly.swarm}</version>
</dependency>
</dependencies>

<build>
<plugins>
(...)
<!-- 2 -->
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>

We had to add dependencies to Swarm's JAX-RS module (1). Such modules are called fractions and you will learn more about them in the next chapter. Please note that we don't need to configure the JAX-RS API dependency directly as it will be provided as the JAX-RS fraction dependency.

Later, we had to configure WildFly Swarm's Maven plugin, which is responsible for building Swarm microservices (2). You will also learn more about it in the next chapter.

That's it. Congratulations! You have just created your first WildFly Swarm application.

Examples reference: chapter2/swarm-hello-world (the whole example is available in the attached code, in the directory: chapter2/swarm-hello-world directory.)
主站蜘蛛池模板: 张家川| 大余县| 永登县| 青冈县| 玉龙| 南皮县| 吕梁市| 城步| 岳西县| 胶南市| 商河县| 麟游县| 渑池县| 平顶山市| 金溪县| 星座| 卢湾区| 德惠市| 台中县| 武胜县| 云浮市| 利津县| 凤翔县| 佛教| 清涧县| 汤原县| 彰化县| 沅陵县| 巴塘县| 志丹县| 天气| 曲麻莱县| 富源县| 慈溪市| 吐鲁番市| 亚东县| 诸暨市| 蓬溪县| 沁源县| 滨海县| 峡江县|