spring-mvc 标签

1 开头

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context
="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

xsi全名:xml schema instance
web-app是web.xml的根节点标签名称
version是版本的意思
xmlns是web.xml文件用到的命名空间
xmlns:xsi是指web.xml遵守xml规范
xsi:schemaLocation是指具体用到的schema资源 

大致就是用到的空间和遵守的规范。

2 <context:component-scan base-package="*"/>

扫描Controller,并将其生命周期纳入Spring管理

 

 3 <import resource="">

 

 4 <mvc:annotation-driven />

 

 

Spring通过context:component-scan/标签的配置,会自动为我们将扫描到的@Component,@Controller,@Service,@Repository等注解标记的组件注册到工厂中,来处理我们的请求

<aop:aspectj-autoproxy />

 

 spring容器中那些配置@aspectJ切面的bean创建代理,织入切面.

在开头也需要引入空间。

 

 5 <mvc:default-servlet-handler/>

 

 prefix和suffix属性可以指定资源页面的前缀和后缀,可以直接把资源位置定位到项目的/WEB-INF/下面

6<mvc:interceptors>

 

 7<bean id="shiroFilter"

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2021-04-23 15:56  未确定  阅读(55)  评论(0编辑  收藏  举报