Creating a simple Spring Boot application using Maven. I have given a value with RestController annotation, but it doesn't work. If I don't use the RestController's value, it works. I want to know, why it's not working and What's the use of value in @RestController?
http://localhost:9090/app/hello this gives error
http://localhost:9090/hello this works fine
@RestController("/app") What's the purpose of "/app" this value inside @RestController annotation?
P.S: I know, I can use @RequestMapping("/app") on ScraperResource class.
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
@RestController("/app")
public class ScraperResource {
@GetMapping("hello")
public String testController() {
return "Hello";
}
}
application.properties
server.port=9090