How to use angular2 with spring boot

I would like to develop an application with angular2 as front end and spring boot as back end. As per my knowledge there are two ways to achive this 1) Create an angular2 app and using rest calls communicate with spring boot application. 2)Having angular2 files in resource folder of spring boot maven application as UI part.

Which is the best way.

Thanks in advance.


The best tutorial I've found that sets up Angular 2 with spring boot is thie Angular2 and Spring Boot

For this tutorial, he utilizes maven modules. One for the spring boot backend, and one for the angular2 front end.

So, to go with option 2, you can just use the angular cli in the tutorial and point it to a resource folder (preferably one you create... ie ui-resources or something) then set up that as a resource in your maven pom.xml. ie

<resource>
    <directory>src/main/ui-resources</directory>
    <excludes>
        <exclude>node_modules/**</exclude>
    </excludes>
 </resource>

Hope that helps!

链接地址: http://www.djcxy.com/p/37776.html

上一篇: 盒子工作与一个div,但不是一个表?

下一篇: 如何使用spring2与spring引导