Question: How to scan all the beans and package declarations in Spring Boot?Answer:Spring Boot application scans all the beans and package declarations when the application initializes. You need to add the @ComponentScan annotation for your class file to scan your components added in your project. @ComponentScan public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } |
保存以便复习
收藏此条目、标记为困难题,或将其加入复习集合。
这有帮助吗? 是 否
用户评价最有帮助的内容:
- What is Spring Boot?
- How to scan all the beans and package declarations in Spring Boot?
- What are embedded containers support by Spring?
- What are the advantages of microservice?
- Mention some advantages of Spring Boot.