Correctness - Method of Singleton class writes to a field in an unsynchronized manner
Oliver-Teng opened this issue · comments
hi i am very puzzled with this bug. the notice detail is "This method writes to a field of this class. Since this class is seen as a Singleton this can produce race conditions, or cause non-visible changes to other threads, because the field isn't accessed synchronously" and this is my code below. could u plz give some suggestions thanks.
@DaTa
@component
@ConfigurationProperties(prefix = "srm")
public class SrmConfig {
private String elsAccount;
private String appId;
private String appSecret;
}
Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.
I couldn't find any bug with the description you provided.
Can you please provide a bit more info, clarify the issue? Which version of spotbugs are you using? What is the exact bugtype or message you are receiving?
That is the USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES bug pattern from fb-contrib. It should be raised at https://github.com/mebigfatguy/fb-contrib/issues
Since this is an issue of fb-contrib, I'm closing this issue.