-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7.3.4 Spring 注解属性别名与覆盖这一章节的疑惑 #37
Comments
待我确认一下,再给出准确的答复 |
|
相关 issue #61 |
小马哥 @mercyblitz 你好,对于 Spring 注解属性覆盖与别名这一章节,个人觉得属性隐式覆盖例子使用
@Service
与@Component
value 属性覆盖有点不合适。测试过程中,发现隐式覆盖对于 value 属性不生效的,查看源码发现,其覆盖属性的排除了 value 属性。源码位置:
MergedAnnotationAttributesProcessor#postProcess
1613 行以下是我的测试例子。
输出结果:
从测试例子可以看到,隐式覆盖确实对 value 属性不生效。
所以个人觉得书中隐式覆盖的例子,会导致误解,认为隐式覆盖不会导致高层次同名属性值被低层次属性值覆盖(高层次属性值等于低层次注解属性值)。
或者说还是我对这个理解错误了?
The text was updated successfully, but these errors were encountered: