我能够通过以下方式做到这一点
@EventListener public void handleContextStart(EnvironmentChangeEvent event) { System.out.println("changed"); //Use this for getting the version from consul }