弹簧和角度JS [英] Spring and Angular JS

查看:48
本文介绍了弹簧和角度JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Spring和angular JS开发应用程序.但是我不知道我在做什么是正确的.在同一个Maven项目中,我做了一个用户类,然后我创建了一个@RestController,在其中创建了我的webservice.在webapp文件夹中,我创建了我使用Angular JS的index.html文件(和一个app.js).我在tomcat服务器上运行了我的应用程序,它运行良好.

I'm developing an application using Spring and angular JS . But I don't know if what I'm doing is correct or not . In the same Maven project , I made a user class then I created a @RestController in which I've created my webservice . In the webapp folder I created my index.html file (and an app.js) in which I used Angular JS . I runned my application on tomcat server and it works fine .

此应用程序是完全客户端吗?我认为Spring MVC会将我的服务作为REST公开,而Angular JS会使用它.我应该将Web服务保留在此应用程序中,并使用Angular JS制作另一个客户端应用程序吗?救救我,我迷路了

is this application Full client side ? what I think is that Spring MVC expose my service as a REST and Angular JS consume it . Should I keep the web service in this app and make another client application using Angular JS ?? help me , I'm lost

推荐答案

您的前端与后端松散耦合,因为双方仅与静态服务交互.如果将AngularJS和spring文件打包在同一应用程序中,则不会破坏这种方法.分离这两个应用程序会带来一些复杂性,如果您需要打包两个可部署文件(例如,一个front.war和一个back.war),则可能会很复杂.如果您没有这种担心,则应保留类似恕我直言的内容.

Your front-end is loosely coupled with the back-end since the two sides interact only with restful services. It does not break this approach if you package both AngularJS and spring files in the same application. Separating the two applications brings some complexity which could be necessary if you need to package two deployable files (one front.war and one back.war for instance). If you don't have this concern, then you should keep things like this IMHO.

这篇关于弹簧和角度JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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