Answer the question
In order to leave comments, you need to log in
Why is text being returned instead of a pattern?
I want to return the template through the controller, but for some reason the text is returned. Everything seems to be like in the guide from the Spring website.
Tell me, please, what could be the problem?
package com.example.test.controller;
import com.example.test.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class RegistrationController {
@GetMapping("/")
public String greeting() {
return "index";
}
@PostMapping("/registrtion")
public User registration(@RequestBody User user) {
return user;
}
}
Answer the question
In order to leave comments, you need to log in
Good afternoon!
Not right:
@RestController
public class RegistrationController {
@Controller
public class RegistrationController {
registration
@PostMapping("/registrtion")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question