首页 > 技术文章 > Spring 获取当前activeProfile

mengjianzhou 2018-04-08 08:50 原文

WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
String profile = wac.getEnvironment().getActiveProfiles()[0];

 

推荐阅读