spring 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"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

一般是学习的话  上面的够用了    声明后就可以使用 xx 属性了    缺少的话整个字体变红

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:task="http://www.springframework.org/schema/task"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/task
        http://www.springframework.org/schema/task/spring-task-3.1.xsd">

有待更新 。。  

模板自用

<?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"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

	<!-- 配置自动扫描的包 --> <!-- 自动扫描控制器 -->
	<context:component-scan base-package="com.ssm"/>
	
	<!-- 视图渲染 -->
	<bean id="internalResourceViewResolver"
		  class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/views/"/>
		<property name="suffix" value=".jsp"/>
	</bean>
	
	<bean id="simpleMappingExceptionResolver"
		  class= "org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
		<property name="exceptionMappings">
			<map>         <!-- key:异常类别(非全称), 视图名称 -->
				<entry key="DatabaseException" value="databaseError"/>
				<entry key="InvalidCreditCardException" value="creditCardError"/>
			</map>
		</property>
		
		<!-- 默认的错误处理页面,异常的名称 -->
		<property name="defaultErrorView" value="spring_error"/>
		<property name="exceptionAttribute" value="ex"/>
		<property name="warnLogCategory" value="example.MvcLogger"/>
	</bean>

	<!-- 控制器映射器和控制器适配器 -->
	<mvc:annotation-driven></mvc:annotation-driven>
	<!-- 静态资源映射器 -->
	<mvc:resources mapping="/views/**" location="/WEB-INF/views/" />
	<mvc:resources mapping="/easyui/**" location="/easyui/" />
	<mvc:resources mapping="/bootstrap/**" location="/bootstrap/" />
	<mvc:resources mapping="/images/**" location="/images/" />
</beans>

猜你喜欢

转载自blog.csdn.net/huang_ftpjh/article/details/81707416