Linked Questions

Popular Questions

Spring + Angular - URL handling

Asked by At

I have Spring Boot app with this version:

    <relativePath/> <!-- lookup parent from repository -->


Frontend part is running on Angular 7. My Tomcat version is Apache Tomcat/8.5.34 I have couple of endpoints that are handled by Spring. What I want to achieve is to let Angular handle some of endpoints. For example: /endpoint1 and /endpoint2 are handled by Spring, but /endpoint3 and /endpoint4 must be handled by Angular

I tried to implement this by adding this ViewController:

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

public class ViewController {

    @RequestMapping({ "/endpoint3", "/endpoint4" })
    public String index() {
        return "forward:/index.html";
        //return "forward:/";   also tried with this

However, I still get 404 when I try to access those endpoints. What am I doing wrong? Any help is appreciated.

Related Questions