Actually, For me below works fine.
@Component
public class MyBean {
public static String prop;
@Value("${some.prop}")
public void setProp(String prop) {
this.prop= prop;
}
public MyBean() {
}
@PostConstruct
public void init() {
System.out.println("================== " + prop + "================== ");
}
}
Now whereever i want, just invoke
MyBean.prop
it will return value.