In the SonarQube scan, it shows a major bug at the below-mentioned lines. The issue says, Singleton class writes to a field in an unsynchronized manner. I am not able to figure out, why this is an issue?
@Configuration
@ConfigurationProperties(prefix = "app")
public class UrlConfigs() {
@Autowired
private List<UrlItems> item;
//Getter & Setter
}
@Component
public class UrlItems {
private String url;
private String location;
// Getter
public void setUrl(String url){
this.url = url; // ISSUE: Singleton class writes to a field in an unsynchronized manner
}
public void setLocation(String location) {
this.location = location; // ISSUE: Singleton class writes to a field in an unsynchronized manner
}
}