将Spring Boot集成到EAR项目中 [英] Integrate Spring Boot in an EAR project

查看:327
本文介绍了将Spring Boot集成到EAR项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an existing war project created using spring boot. How to package it within an EAR which has an EJB module?

有什么方法可以将模型和dao包移至EJB模块,然后将其注入WAR模块?

Is there any way to move the model and dao packages to EJB module and injecting it with WAR module?

推荐答案

您必须使用依赖项管理系统.

You have to use the dependency management system.

它允许您将Spring Boot WAR模块项目的父级设置为与spring-boot-starter-parent不同的父级.这样就有可能以与其他任何方式相同的方式将WAR项目包含到EAR中.

It allows you to set the parent of Spring Boot WAR module project to the different from the spring-boot-starter-parent. Then it's would be possible to include the WAR project into the EAR one in the same way like any other.

<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启动器依赖项:

... now you can use all the Spring Boot starter dependencies in the usual way:

<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项目,或者在每个项目上分别指定,具体取决于应用程序的要求.

The starter dependencies you've to specify at the module projects level, while the dependency management configuration may be specified at the both ones - around the whole EAR projects or individually on each of them, depending on the app requirements.

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆