What is the best way of passing parameters into TestConfig.class below? I cannot figure it out.
Calling method like this from command line:
com.test.app.Launcher --param.1=test1 --param.2=test2
Main method code is:
public static void main(String[] args) throws Throwable {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TestConfig.class);
// ...
}
Later on in the program, I want to access the parameters as follows...
public class TestConfig {
// how do I access the values in clps here? is this right??
@Autowired
private Environment env;
private final String PARAM_1 = env.getProperty("param.1");
private final String PARAM_2 = env.getProperty("param.2");
}