I have checked this link How to make spring inject value into a static field
But , my requirement is little different. I know it is against Spring's IoC , but I need to do this workaround.
package foo.package
@Controller
public class SomeController{
public static int var = -1;
private String someStringField = null;
// n- number of non-static fields
/**
* Constructor
*/
public SomeController(){
someStringField = "some Value" ; // This is just for example.
}
}
Now , I need to add a static block and set the static field var
with some value from Spring's context xml.
According to the code segment given in the link ,
can I call clinit
in place of method name ?
Thanks in advance.