IniSecurityManagerFactory不推荐使用
在1.7.1版本的shiroQuickstart中IniSecurityManagerFactory被标记为Deprecated,文档中建议用Environment机制代替
点进源码查看
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25import org.apache.shiro.mgt.SecurityManager; /** * An {@code Environment} instance encapsulates all of the objects that Shiro requires to function. It is essentially * a 'meta' object from which all Shiro components can be obtained for an application. * <p/> * An {@code Environment} instance is usually created as a result of parsing a Shiro configuration file. The * environment instance can be stored in any place the application deems necessary, and from it, can retrieve any * of Shiro's components that might be necessary in implementing security behavior. * <p/> * For example, the most obvious component accessible via an {@code Environment} instance is the application's * {@link #getSecurityManager() securityManager}. * * @since 1.2 */ public interface Environment { /** * Returns the application's {@code SecurityManager} instance. * * @return the application's {@code SecurityManager} instance. */ SecurityManager getSecurityManager(); }
使用idea翻译插件翻译后的结果
使用快捷键Ctrl+H查看该接口的继承树:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20/** * Basic usage:<p> * <code> * Environment env = new BasicIniEnvironment("classpath:shiro.ini"); * SecurityManager securityManager = env.getSecurityManager(); * </code> * * @since 1.5 */ public class BasicIniEnvironment extends DefaultEnvironment { public BasicIniEnvironment(Ini ini) { setSecurityManager(new IniSecurityManagerFactory(ini).getInstance()); } public BasicIniEnvironment(String iniResourcePath) { this(Ini.fromResourcePath(iniResourcePath)); } }
用这种方式就好了
最后
以上就是贪玩身影最近收集整理的关于shiro1.7.1--Quickstart--IniSecurityManagerFactory的全部内容,更多相关shiro1内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复