Skip to content

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

Description

@zzziCode

当前属为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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions