创建一个shiro例子(未完成)

编程入门 行业动态 更新时间:2024-10-09 15:23:31

<a href=https://www.elefans.com/category/jswz/34/1771345.html style=创建一个shiro例子(未完成)"/>

创建一个shiro例子(未完成)

1.使用maven命令创建一个webapp项目
mvn archetype:generate -DgroupId=org.zx -DartifactId=shiroExample -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false -DarchetypeCatalog=local

2.打开你的开发工具idea或者eclipse 导入之前创建的项目
打开pom.xml文件添加以下依赖

<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.4.0</version>
</dependency>

<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.4.0</version>

3.打开web.xml添加以下过滤器
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>

4.resource目录下,添加shiro.ini 文件,添加以下内容到文件中
[admin]
[urls]
/index.html = anon
/user.html = authc

更多推荐

创建一个shiro例子(未完成)

本文发布于:2024-02-26 03:08:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1701168.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建一个   未完成   例子   shiro

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!