Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 492
Syam Sankar Avatar asked Jan 03 '17 05:01

Syam Sankar


1 Answers

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... i.e. ui-resources or something) then set up that as a resource in your maven pom.xml. i.e.

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

Hope that helps!

like image 174
Gary McGuire Avatar answered Sep 23 '22 04:09

Gary McGuire