Spring controller gets invoked but returns 404 : <p>I am writing a Spring Boot application. I have written a simple controller that gets invoked whenever the endpoint is hit, but it still returns status 404 and not the specified return value.</p>

<p><strong>HelloController</strong></p>

<pre><code>@Controller
public class MessageRequestController {

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

<p>Now whenever I call <code>localhost:8080/hello</code>, I see the console log <code>"Hit me!"</code>, but <code>"Hello, you!"</code> is never returned. Postman outputs:</p>

<pre><code>{
    "timestamp": 1516953147719,
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/hello"
}
</code></pre>

<p><strong>Application.java</strong></p>

<pre><code>@SpringBootApplication
@ComponentScan({"com.sergialmar.wschat"}) // this is the root package of everything
@EntityScan("com.sergialmar.wschat")
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
</code></pre>
