我们接着上一篇博客搭建SSM+SpringSecurity环境来实现一个基于springSecurity简单认证的项目
1. 对springMvc.xml文件进行配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<!--配置包扫描-->
<context:component-scan base-package="Controller"></context:component-scan>
<!--配置注解方式-->
<mvc:annotation-driven></mvc:annotation-driven>
<!--配置资源视图解析器,前缀后缀-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
2. 对Controller层进行开发
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping("/add")
public String add() {