I have a Spring boot application and I have two completely independent angular projects. One project for the end user and another project for the admin. For business reasons, I am forced to have both of them as two different projects. I want both these projects to be packaged into the same WAR and when the user hits the URL for the end user, the end user angular application should be loaded and when the admin URL is accessed, the admin angular project should be loaded.
I know that Spring boot loads the angular project from /public or /static directories. However, since in my case, I have two different projects, I cant put them under the same folder since both of them have many file names in common including index.html.
So far, I have done the following:
- Created two different folders under
"public"as"enduser"and"manage". Created a controller which has two methods :
@Controller public class SampleController { @RequestMapping(method = RequestMethod.GET, produces = "text/html", value = "/enduser") public String enduser() { return "/enduser/index.html"; } @RequestMapping(method = RequestMethod.GET, produces = "text/html", value = "/admin") public String admin() { return "/admin/index.html"; } }
However, when I do like this only the index.html file is loaded and the other components are not loaded(by which I mean the entire angular project is not loaded). So the dependent views and styles etc are not loaded.
Does anybody have an idea on how to handle the above scenario? Thanks.