0

I am building an angular 2 java EE spring boot web application within eclipse neon. For development reasons, I wanted to simply keep my angular files within my java project, but this is looking like a bad idea, since the node_modules folder for the angular 2 source is the meat of the angular source (over 150 MB), it is causing my project to build and run extremely slowly.

What is the best way to keep my angular files outside of my java project and connect to it via spring boot and java? What is the preferred method? Thanks!

jny
  • 8,007
  • 3
  • 37
  • 56
J-man
  • 1,743
  • 3
  • 26
  • 50
  • If it's making the IDE slow you can probably tell it to ignore the node_modules directory, so it doesn't bother indexing the content etc. See e.g. http://kwebble.com/blog/2014/12/27/speed-up-eclipse-by-excluding-node-modules-from-validation – jonrsharpe May 10 '17 at 13:58
  • Thanks @jonrsharpe, I do have some dev projects with angular components inside and I will try this out to see if it speeds up the build and debug. – J-man May 10 '17 at 14:34
  • Here is a link (I know including links is not preferred because the link can break in the future) on stackoverflow of a similar answer to excluding node_modules (or any folder) within a java application --> http://stackoverflow.com/questions/2272237/how-to-exclude-specific-folders-or-files-from-validation-in-eclipse I excluded JavaScript validation on the node_modules folder – J-man May 10 '17 at 14:42

1 Answers1

2

I faced this problem while ago. i solved like this

  • create your spring boot in STS or Eclipse
  • write your Angular app in VS code IDE ( its awesome )

To use consume REST service created by Spring Project in Angular use proxy.conf.json.

{
“/spirngapi” :{
“target” : “http://localhost:8080”,
“secure” : false
}
}

this will redirect Angular http calls to your spring application file.

For production you can generate production build in Angular and Copy file in to war file.

CharanRoot
  • 6,181
  • 2
  • 27
  • 45