当前位置:网站首页>ComponentScan和ComponentScans的区别
ComponentScan和ComponentScans的区别
2022-07-03 02:56:00 【一尾流鸢cd】
在Spring中@ComponentScan()被用来扫描某包下的注解,ComponentScans也是用来扫描注解的,但是它们之间的不同是:
- ComponentScan可以每次写一个或者多个包
@ComponentScan往往是注解在@Configuration的类中,用于添加自动扫描的包。我们可以通过属性basePackages或者value指定一个或者多个要扫描的包。@ComponentScan("com.nn")
@ComponentScan(value = {"com.nn.bean","com.nn.dao"})
- ComponentScans可以声明多个ComponentScan
@ComponentScans是另外一个扫描包的注解,有一个数组形势的属性value,而数组的类型就是@ComponentScan,也就是一个@ComponentScans中可以配置多个@ComponentScan@ComponentScans(value={@ComponentScan("com.nn.bean"),@ComponentScan("com.nn.service")})
边栏推荐
- Le processus de connexion mysql avec docker
- Add MDF database file to SQL Server database, and the error is reported
- 一文带你了解 ZigBee
- Cancer biopsy instruments and kits - market status and future development trends
- Update and return document in mongodb - update and return document in mongodb
- Distributed transaction
- 处理数据集,使用LabelEncoder将所有id转换为从0开始
- Counter统计数量后,如何返回有序的key
- 为什么会选择框架?选择什么样的框架
- I2C 子系统(二):I3C spec
猜你喜欢
超好用的日志库 logzero
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Three.js本地环境搭建
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
Check log4j problems using stain analysis
HTB-Devel
Segmentation fault occurs during VFORK execution
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
Baidu map - surrounding search
随机推荐
Update and return document in mongodb - update and return document in mongodb
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
SQL statement
[translation] the background project has joined the CNCF incubator
Classes and objects - initialization and cleanup of objects - constructor call rules
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Apple releases MacOS 11.6.4 update: mainly security fixes
How to select the minimum and maximum values of columns in the data table- How to select min and max values of a column in a datatable?
sql server 查询指定表的表结构
[translation] modern application load balancing with centralized control plane
The difference between left value and right value in C language
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
HW initial preparation
Kubernetes family container housekeeper pod online Q & A?
Sqlserver row to column pivot
How to change the panet layer in yolov5 to bifpn