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!

3
  • 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. kwebble.com/blog/2014/12/27/… Commented May 10, 2017 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. Commented May 10, 2017 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 --> stackoverflow.com/questions/2272237/… I excluded JavaScript validation on the node_modules folder Commented May 10, 2017 at 14:42

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

This is exactly what I'm looking for! Thanks!
Happy to help. if you like my answer you can mark as best answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.