创建一个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例子(未完成)
发布评论