Angular 4 + web pack + spring mvc (not boot) integration and deployment on tomcat -


recently learnt angular 4 , want use spring mvc web application.

i can use both separately struggling put run single application spring security in place.

could please advise how should achieve it. examples on internet working spring boot , separate module.

the trick set angular cli's build target "target/classes/static" , tell spring serve resources there (spring boot automatically).

more detailed (when using maven):

  1. create 3 maven modules: backend (with java app), frontend (with angular app), webapp (referencing both dependency)
  2. in frontend change "outdir" in .angular-cli.json "target/classes/static"
  3. in frontend use maven frontend plugin call npm install / npm run build
  4. in webapp module add spring resource handler classpath:/static

you can in 1 module prefer separate frontend , backend.

you can see our working example here (using spring boot): https://github.com/porscheinformatik/angular-spring-heroes


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -