Spring controller gets invoked but returns 404

Change your method return a ResponseEntity<T>

@RequestMapping(method = RequestMethod.GET, value = "/hello", produces = "application/json")
public ResponseEntity<String> hello() {
    System.out.println("Hit me!");
    return new ResponseEntity<String>("Hello, you!", HttpStatus.OK);
}

or change the controller to RestController

@RestController
public class MessageRequestController {...}

CURL

ubuntu:~$ curl -X GET localhost:8080/hello
Hello, you!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)