最近搜索

SpringBoot获取ServletContext和webApplicationConnect几种方法 全局变量 缓存

浏览:1471
管理员 2019-09-04 16:21


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");
		



    @Autowired 
    WebApplicationContext webApplicationConnect;


  •  ServletContext servletContext = webApplicationConnect.getServletContext();


联系站长

站长微信:xiaomao0055

站长QQ:14496453