79364798

Date: 2025-01-17 12:48:09
Score: 1
Natty:
Report link

This is happening due to the @Controller annotation. By default controller annotation return the view in spring. If your application is getting and returning json better to use @RestController annotation that is return json response by default

  @RestController
public class UserController {

@Autowired
private UserService userService;



 @PostMapping("/user/add")


public void addNewUser(@RequestBody User user) throws BLException {
 userService.addNewUser(user);


}

}
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Controller
  • User mentioned (0): @RestController
  • Low reputation (0.5):
Posted by: Shahid Hussain