spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
707 stars 704 forks source link

ConfigurationPropertiesRebinder finally use method.invke(xx) to update field , Is there an issue with memory visibility here ? #1235

Open Inuyasha-Monster opened 1 year ago

Inuyasha-Monster commented 1 year ago
@ConfigurationProperties(prefix = "book")
@Component
public class BootConfig {
    private String author;
    private String category;

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @Override
    public String toString() {
        return "BootConfig{" +
                "author='" + author + '\'' +
                ", category='" + category + '\'' +
                '}';
    }
}

there fields no volatile flag....

kimmking commented 9 months ago

IMO, that's not in a level between config properties and volatile fields.