I am starting to learn Spring Boot. I am struggling to find an example with multiple RestControllers, which indicates to me that I may be doing something wrong. I am trying a ve
Try below:-
@ComponentScan
@Configuration
@EnableAutoConfiguration
public class BootDemoApplication {
public static void main(String[] args) {
SpringApplication.run(BootDemoApplication.class);
}
}
@RestController
@RequestMapping(value = "test", produces = MediaType.APPLICATION_JSON_VALUE)
public class TestController {
@RequestMapping(method = RequestMethod.GET)
public String test() {
return "from test method";
}
}