@Requestmapping does not work on Intellij

Asked

Viewed 30 times

0

The same code works on Eclipse and Spring Tool Suit, but not on Intellij Ultimate Edition. I’ve tried to recreate the project from scratch and still nothing. Using the same dependencies and files in the same location, I created an html to be pulled by Controller, but when I try to run the application the page does not open when typing 127.0.0.1:8080/cadastro. I am using Java Openjdk 11 and the latest version of Intellij

package controllers;

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

@Controller
public class CadastroController {

    @RequestMapping("/cadastro")
    public String cadastrodefuncionarios(){
        return = "/cadastro/cadastro";
    }
}
Erro:
This site can’t be reached127.0.0.1 refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

1 answer

0

Try to make these changes that will give the same result you want.

@RestController
@RequestMapping(path = "/cadastro")
public class CadastroController {

    @GetMapping
    public String cadastrodefuncionarios(){
        return = "/cadastro/cadastro";
    }
}
  • with this code he is not opening the HTML file, qndo abro in the browser appears the text written "/register/register", vc knows what can be?

  • It seems that there are some bugs that like I get the class controler, then I get it, then I change some value and then I come back saved as it was before working and stop picking up ahueaehuae, mocking this, it’s giving me headaches programming in Java, it seems that in c# it was more consistent things in Visual Studio

Browser other questions tagged

You are not signed in. Login or sign up in order to post.