1

My application is a spring boot and angular 5 with angular as dependency added into spring boot app, Packaging is like

Backend Jar:

enter image description here

The angular app jar in in BackendJar\BOOT-INF\lib\angularapp.jar

The application loads the home page on load home(/) no problem here but here I have a scenario where I need to navigate to home (/) when some condition is met in controller, like below:

@RequestMapping(value="/",method = RequestMethod.GET)
public String getUser(HttpServletRequest request) {
   if(request.getHeader("USER")=="something") {
      return "home"; //return Home page
   } else {
      return "error"; //error page here
   }
}

But spring throws a 404 when I try to navigate to home from controller like above. If I remove the @RequestMapping(value="/",method = RequestMethod.GET) it happily loads the home component.

What am I doing wrong here:

Do I need to give the exactly html name here or do I need to give the name in the router. {path: 'home', component: HomeComponent} or home.component.html

4

0

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.