import org.springframework.web.context.ContextLoader; // web.xml文件中已经启用数据权限 String enableDataSecurity = ContextLoader.getCurrentWebApplicationContext().getServletContext().getInitParameter("EnableDataSecurity");
web.xml
<!-- Enable data security --> <context-param> <param-name>EnableDataSecurity</param-name> <param-value>true</param-value> </context-param>