Skip to content
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

属性占位符替换时,如果当前bean存在String类型的属性但是不用占位符替换,会重复添加PropertyValue #69

Open
zzziCode opened this issue Mar 11, 2024 · 0 comments

Comments

@zzziCode
Copy link

当前属为String类型时,会尝试使用resolvePlaceholder来进行占位符替换,对于直接使用value来指定属性值的属性不会有任何作用:

image-20240311143928710

但是这里没有添加判断,导致重复添加PropertyValue,虽然不会影响后面bean的创建,但是属性列表有重复项也是一种冗余

image-20240311143756148

增加了一定的判断之后:

image-20240311144024800
出现问题的代码在:
https://github.com/DerekYRC/mini-spring/blob/ef07ca1105b4c57b70d63a50425a0de6d6b5814a/src/main/java/org/springframework/beans/factory/PropertyPlaceholderConfigurer.java#L78C5-L78C88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant