当前位置:网站首页>The bean injected through @autowired can still be injected even if the class is not annotated with annotations such as @comment
The bean injected through @autowired can still be injected even if the class is not annotated with annotations such as @comment
2022-07-24 10:54:00 【dotaer-df】
Problem description : During unit testing in the company's project, I found , Even if there is no annotation on this class @Comment perhaps @Service And so on , however Bean Can still be injected .
Logically speaking springboot When scanning , Classes without annotations will not be loaded into ioc Inside the container , It's strange . Because it is common to inject classes into ioc In the container , Nothing more than through annotations and xml, Annotations are not configured , That should be through xml Instantiate , After investigation, it was found that , Pass... In the startup class @ImportResource Imported xml file applicationContext.xml In this xml There is such a configuration in
<context:component-scan base-package="com.xxx.xxx">
<context:include-filter type="aspectj"
expression="com.xxx.xxx..impl..*BOImpl"/>
<context:include-filter type="aspectj"
expression="com.xxx.xxx..impl..*ServiceImpl"/>
</context:component-scan>
context:include-filter There are five types of filters type:
assignable- Specify to scan the classes derived from an interface
annotation- Specify to scan classes that use an annotation
aspectj- Specify scan AspectJ Expression matching class
custom- Specify the implementation of scanning customization org.springframework.core.type.filter.TypeFilter The class of the interface
regex- Specify to scan classes that conform to regular expressions
So at present expression The classes under the set path will be automatically injected into the container
边栏推荐
- 零基础学习CANoe Panel(3)—— 静态控件(Static Text , Group Box ,Picture Box)
- Redis cache settings, similar to putifabsent function
- Qt程序最小化托盘后,再弹出个msgbox,点击确定后程序退出问题解决
- App automation and simple environment construction
- 零基础学习CANoe Panel(6)—— 开关/显示控件(Switch/Indicator)
- [interview: Basics 03: selection sort]
- read_csv 报错:‘gbk‘ codec can‘t decode byte 0xb4 in position 274: illegal multibyte sequence
- [FPGA]: IP core DDS
- Is it safe to open an online stock account?
- The method modified by private can be accessed through reflection. What is the meaning of private?
猜你喜欢

PC Museum (2) 1972 hp-9830a

Rtklib source code, RTK difference calculation, rtkpos and replos function process sorting

563页(30万字)智慧化工园区(一期)总体设计方案

Signal processing: < three > DFT and FFT

Five network IO models

Activity review | Anyuan AI X machine heart series lecture No. 1 | deepmind research scientist rohin Shah shares "finding a safe path for AgI"

Qt创建应用程序托盘及相关功能
![[FPGA]: use of MicroBlaze](/img/f4/5114bf4bde10adaa22c7441350575c.png)
[FPGA]: use of MicroBlaze

变频器的工作原理和功能应用

数组元素移除问题
随机推荐
Activity review | Anyuan AI X machine heart series lecture No. 1 | deepmind research scientist rohin Shah shares "finding a safe path for AgI"
Disk storage chain B-tree and b+ tree
题解——Leetcode题库第283题
Five application scenarios of Bluetooth module
When to use obj['attribute name'] for the attribute name of an object
[FPGA]: IP core - multiplier
[FPGA]: IP core ibert
Five network IO models
[about Modelsim simulation] design and Simulation of 4-bit counter
数据可视化-《白蛇2:青蛇劫起》(1)
Modbus RTU通讯协议详解与实例演示
Problem solving -- question 283 of leetcode question bank
PyTorch 常用 Tricks 总结
变频器的工作原理和功能应用
ECCV 2022 | Tsinghua proposes the first transformer to embed spectral sparsity
Sentinel flow control quick start
binlog、iptables防止nmap扫描、xtrabackup全量+增量备份以及redlog和binlog两者的关系
零基础学习CANoe Panel(4)——按钮(Button )
零基础学习CANoe Panel(6)—— 开关/显示控件(Switch/Indicator)
划分数据1