简体   繁体   English

将前端与后端分开。 Spring-boot 和 Angular2

[英]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 是您将部署到服务器的那个。

这个示例应用程序及其附带的演示文稿描述了一种使用前端/后端模块组织 Spring Boot 应用程序的方法,同时仍然利用 devtools 功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular(SPA) 前端和 spring 引导后端的 SAML 2.0 集成 - SAML 2.0 integration for Angular(SPA) front end and spring Boot backend 如果我们使用前端 Angularjs 和后端 spring-boot,则被 CORS 策略处理阻止? - blocked by CORS policy handling if we using front-end Angularjs and back-end spring-boot? Angular js 是前端还是后端? - Angular js is front end or backend? Angular js从后端到前端检索和显示数据 - Angular js retreiving and displaying data from backend to front end 如何将多个对象从Angular2发送到Java Spring后端 - How to send multiple objects from Angular2 to Java Spring backend Node.js / AngularJS前端调用Spring Boot API后端 - Node.js/AngularJS front end calling Spring Boot API backend 带有弹簧启动安全性api的Angular 2 - angular 2 with spring-boot security rest api Spring RESTful后端和Angularjs前端:如何从客户端添加参数? - Spring RESTful backend and Angularjs front end : How to add parameters from the client side? 如何使用Visual Studio中的angular + bootstrap(前端)+ IIS(后端)调试应用程序? - How do I debug apps using angular+bootstrap (front end) + IIS (backend) from Visual Studio? 如何将CSRF令牌从AngularJS前端发送到Spring REST服务后端? - How do I send CSRF tokens from AngularJS front end to Spring REST service backend?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM