Felipe S. Felipe S. - 1 year ago 90
AngularJS Question

How to setup structure with SpringBoot and Angular2?

I'm trying to use Angular2 with Springboot, but I can't set them together.

I first started a springboot project, and then tried to follow the Angular 2 Tour of Heroes by johnpapa and run

npm install

The structure looks like below:


I have the
folder, and the
are compiled to


1) The folder
has lots of files. So when running
, it gets really slow and sometimes can't even refresh the files. I believe I shouldn't put the node_modules there, but not sure..

npm install
puts the files in
so currently I copied them to
folder. Should I just build the

3) My structure looks hacky.. what is the best way to do it ?

How to set this structure? Also, please let me know if I should start using grunt/gulp or some other tool to make this easier.

Ps.: In case anyone is interested in the johnpapa's guide: johnpapa's angular2 guide

Answer Source

1) Remove node_modules from static folder. Your build process should bundle all the necessary modules. node_modules is used only during build.

2) Do not copy node_modules into static folder

3) Remove sources from static folder. That one is meant only for generated bundle + some static PROD files like index.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download