0

I have a class in which I want to read a property file and initialize a static field using @value, but this always comes as null

public class MyClass{

@value(${my.value})
private static String myValue;
}

So my question here,

  1. Is there any workaround to do this like using a static setter.
  2. Why it does not work with static field, if I change it to non static it starts working :(
ankit
  • 4,919
  • 7
  • 38
  • 63

0 Answers0