使用版本Shiro版本 v1.8.0,当时最新版,
遇到的问题
从官网推荐在GitHub上查找源码
GitHub网址:https://github.com/apache/shiro
GitHub上的案例: samples/quickstart/src/main/java/Quickstart.java,在实操中遇到如图问题
在获取shiro.ini文件时发现IniSecurityManagerFactory过期,爆红,证明在以后的jdk版本中IniSecurityManagerFactory应该被删除了。
通过查阅资料,
解决方法:
DefaultSecurityManager defaultSecurityManager=new DefaultSecurityManager();
IniRealm iniRealm=new IniRealm("classpath:shiro.ini");
defaultSecurityManager.setRealm(iniRealm);
// for this simple example quickstart, make the SecurityManager
// accessible as a JVM singleton. Most applications wouldn't do this
// and instead rely on their container configuration or web.xml for
// webapps. That is outside the scope of this simple quickstart, so
// we'll just do the bare minimum so you can continue to get a feel
// for things.
SecurityUtils.setSecurityManager(defaultSecurityManager);
测试 Quickstart.java
成功打印出相关的日志信息。