[英]Separating the front end from the backend. Spring-boot and Angular2
I am trying to figure out how to separate the frontend from the backend.我想弄清楚如何将前端与后端分开。 Example----
例子 - -
DemoProject
------ DemoProject
------
-----------`backend` (module)
-------`frontend` (module)
src
pom.xml pom.xml
Frontend will be Angular and the backend will be Spring-boot.前端是 Angular,后端是 Spring-boot。 I am trying to find a sample project or hopefully someone can point me in the right direction.
我正在尝试找到一个示例项目,或者希望有人能指出我正确的方向。 I do not want to make a monolithic application, more micro service type application.
我不想做单体应用,更微服务类型的应用。
One approcach would be to generate an EAR and deploy it to any enterprise application server.一种方法是生成 EAR 并将其部署到任何企业应用程序服务器。
If you are using maven, then you can have achieve this using a multi-module project.如果您使用的是 maven,那么您可以使用多模块项目来实现这一点。
For this approach you can have 3 child modules and 1 parent module.对于这种方法,您可以拥有 3 个子模块和 1 个父模块。
You can put the front end code in one module and let the pom.xml generate a WAR out of it.您可以将前端代码放在一个模块中,然后让 pom.xml 从中生成一个 WAR。
The second module will have all your back-end code and its pom will generate a JAR (or a WAR is also fine).第二个模块将包含您所有的后端代码,它的 pom 将生成一个 JAR(或者 WAR 也可以)。
The third module will do nothing apart from simply packing the JAR and the WAR into an EAR.除了简单地将 JAR 和 WAR 打包到 EAR 中之外,第三个模块不会做任何事情。
These three modules will be the child modules.这三个模块将是子模块。
The parent module is just the aggregator module which will execute the pom for each of its child modules.父模块只是聚合器模块,它将为其每个子模块执行 pom。 This way, you will you will end up having a JAR, WAR and an EAR.
这样,您最终将拥有 JAR、WAR 和 EAR。 The EAR is the one that you will deploy to your server.
EAR 是您将部署到服务器的那个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.