@ComponentScan什么时候可以不加
2024-09-05 07:22:03
SpringBoot在没配置@ComponentScan的情况下,默认只扫描和主类处于同包下的Class。
主类Application.java:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
//@ComponentScan(basePackages = "com.自定义.mall")如果不加,只扫描和主类处于同包下的Class。
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
不加的可用情况
必须要加的情况
最新文章
- 「拉勾网」薪资调查的小爬虫,并将抓取结果保存到excel中
- linux--分卷压缩解压缩
- 深入浅出TCP协议的三次握手过程
- iOS开发数据库SQLite的使用
- CodeForces 492B
- SQL Server 2008 修改表名
- golang升级
- python多线程和多进程使用
- 学习使人快乐5-JavaWeb应用的组成结构
- bootstrap-table初使用
- linux shell脚本检测硬盘磁盘空间 邮件报警
- MySQL mysql server与存储引擎
- oracle跟踪sql语句
- aclocal: error: aclocal: file '/usr/local/share/aclocal/wxwin.m4' does not exist
- 希尔伯特曲线——第八届蓝桥杯C语言B组(国赛)第三题
- PL/SQL在 win8.1系统下连接Oracle11g没有database处理方法(亲身实验,吐血分享)
- 51nod 1486 大大走格子——dp
- perl6中函数参数(2)
- https过程
- C#获取视频文件播放长度