将Spring Boot集成到EAR项目中

沙吉

我有一个使用Spring Boot创建的现有战争项目。如何将其打包在具有EJB模块的EAR中?

有什么方法可以将模型和dao包移至EJB模块,并与WAR模块一起注入?

WildDev

您必须使用依赖性管理系统。

它允许您将Spring BootWAR模块项目的父项设置为spring-boot-starter-parent然后,可以像其他WAR项目EAR一样项目包含其中。

<dependencyManagement>
     <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.2.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

...现在您可以按通常方式使用所有Spring Boot启动器依赖项:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
</dependencies>

您必须在模块项目级别指定启动程序依赖项,而依赖项管理配置可以在两个EAR项目中都指定-围绕整个项目或在每个项目中分别指定,具体取决于应用程序的要求。

在没有父POM的情况下使用Spring Boot

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章