I am making a program and I need to read from main args but I don't know how to proceed.
my code
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
controller
@Controller
public class SampleControler {
@Autowired
private Checker checker;
@RequestMapping("/monitoring")
String home(Model map)
{
try {
map.addAttribute("donnee", checker.run(/*My main args has to be there*/);
return "index" ;
}catch (Exception e) {
return "error";
}
}
}
Can you anyone help?
As described in the manual you'll need to add command line arguments like
to your application.
In your
SampleControler
you can access those arguments through the Environment: