mardi 4 avril 2017

Spring boot, find out context-url programatically

I like to print out what is the context-url of the application at start.

@Autowired
ServletConfig config;

@PostConstruct
public void test() {
    System.out.println(config.getServletContext().getContextPath());
}

Throws a NullPointerException because there is no context.

Any idea?




Aucun commentaire:

Enregistrer un commentaire