java – SpringBoot and Angularjs Routes


I'm trying to put a friendly url to remove the '#' from the angular url, I followed the following tutorial: /spring-boot-as-a-backend-for-angularjs/

and it worked on the static url. But if I do this

  .state('site3.evento', {//angular
              url: '/evento/:informacaoEventoId',
              templateUrl: 'tpl-site/evento.html',

public String evento() {
    return "forward:index.html";

public void addResourceHandlers(ResourceHandlerRegistry registry) {


As the id is dynamic, there is an error, it cannot display the page, the error is this:

o.s.boot.context.web.ErrorPageFilter     : Cannot forward to error page for request [/evento/208] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting to false


public class RouteController implements Serializable{

private static final long serialVersionUID = 1L;

public String index() {
    return "forward:index.html";

public String evento(@PathVariable String informacaoEventoId) {
    return "forward:index.html";



public class Application extends SpringBootServletInitializer {  

protected SpringApplicationBuilder configure(
        SpringApplicationBuilder application) {
    return application.sources(Application.class);

public static void main(String... args) {
            System.getProperty("spring.profiles.default", "dev"));
    final ApplicationContext applicationContext =
            Application.class, args);


The error I'm seeing is the lack of definition of the informationEventoId parameter in the evento method. It must be annotated with @PathVariable

The code should look like this:

public String evento(@PathVariable String informacaoEventoId) {
    return "forward:index.html";
Scroll to Top