@Resource private ConfigurableEnvironment springEnv;
@GetMapping("printenv") public R printenv(){ String result = ""; MutablePropertySources propSrcs = springEnv.getPropertySources(); // 获取所有配置 Iterator<PropertySource<?>> propertySources = propSrcs.iterator(); while(propertySources.hasNext()) { PropertySource propertySource = propertySources.next(); Object source = propertySource.getSource(); if(source instanceof Map ) { Map map = (Map) source; for(Object key:map.keySet()) { result +=key+"=" + map.get(key)+";"; } } } return new R(result); }