I am working on a Spring Boot Application. I am getting a 404 error on hitting the URL-path which I have configured. Where am I going wrong?
HomeController.java
package com.example.homes;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("/add")
public class HomeController {
@GetMapping("/hello")
public String add() {
return "Hello";
}
}
HomeApplication.java
package com.example.homes;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class HomeApplication {
public static void main(String[] args) {
SpringApplication.run(HomeApplication.class, args);
System.out.println("Inside main");
}
}