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
For Spring-boot 1.3.x and up, passing a base package to SpringBootApplication should work:
@SpringBootApplication(scanBasePackages = {"com.demo"})
public class DemoBootApplication {
// code
}
This worked for me on a similar application using spring-boot 1.4.0. For earlier versions of spring-boot, it appears you'll have forego using SpringBootApplication and instead use the following to get same effect as above:
@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.demo"})
public class DemoBootApplication {
// code
}
I found this in the comments on this blog post.