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):
- create 3 maven modules: backend (with java app), frontend (with angular app), webapp (referencing both dependency)
- in frontend change "outdir" in
.angular-cli.json
"target/classes/static" - in frontend use maven frontend plugin call
npm install
/npm run build
- 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
Post a Comment