SpringBoot获取ServletContext和webApplicationConnect几种方法(application) 全局变量
service controller下面这样拿
@Autowired
private ServletContext servletContext;
JSONObject token = (JSONObject) servletContext.getAttribute("token");
@Autowired
private ServletContext servletContext;
Config config = (Config) servletContext.getAttribute("config");
ServletContext servletContext = webApplicationConnect.getServletContext();
站长微信:xiaomao0055
站长QQ:14496453