mini-spring
mini-spring copied to clipboard
属性占位符替换时,如果当前bean存在String类型的属性但是不用占位符替换,会重复添加PropertyValue
当前属为String
类型时,会尝试使用resolvePlaceholder
来进行占位符替换,对于直接使用value
来指定属性值的属性不会有任何作用:
但是这里没有添加判断,导致重复添加PropertyValue
,虽然不会影响后面bean的创建,但是属性列表有重复项也是一种冗余:
增加了一定的判断之后:
出现问题的代码在:
https://github.com/DerekYRC/mini-spring/blob/ef07ca1105b4c57b70d63a50425a0de6d6b5814a/src/main/java/org/springframework/beans/factory/PropertyPlaceholderConfigurer.java#L78C5-L78C88