我是靠谱客的博主 贪玩身影,最近开发中收集的这篇文章主要介绍shiro1.7.1--Quickstart--IniSecurityManagerFactory,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
IniSecurityManagerFactory不推荐使用
在1.7.1版本的shiroQuickstart中IniSecurityManagerFactory被标记为Deprecated,文档中建议用Environment机制代替
点进源码查看
import 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查看该接口的继承树:
/**
* 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.7.1--Quickstart--IniSecurityManagerFactory所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复