2016.4.07定义一个spring注释注入
来源:互联网 发布:9是什么意思网络语言 编辑:程序博客网 时间:2024/06/05 07:07
<?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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
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">
<context:component-scan base-package="com.certusnet.pile.controller" use-default-filters="false"><!-- 定义注释注入的包 -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
<context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
</context:component-scan>
<mvc:annotation-driven><!-- -->
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<constructor-arg value="UTF-8" />
</bean>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="prettyPrint" value="true"/>
<property name="supportedMediaTypes" value="*/*"></property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 定义JSP文件的位置 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="1"/><!-- 此处定义为1为什么? -->
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:default-servlet-handler/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="java.lang.Throwable">/errorDoc/404</prop>
</props>
</property>
</bean>
</beans>
<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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
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">
<context:component-scan base-package="com.certusnet.pile.controller" use-default-filters="false"><!-- 定义注释注入的包 -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
<context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
</context:component-scan>
<mvc:annotation-driven><!-- -->
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<constructor-arg value="UTF-8" />
</bean>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="prettyPrint" value="true"/>
<property name="supportedMediaTypes" value="*/*"></property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 定义JSP文件的位置 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="1"/><!-- 此处定义为1为什么? -->
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:default-servlet-handler/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="java.lang.Throwable">/errorDoc/404</prop>
</props>
</property>
</bean>
</beans>
0 0
- 2016.4.07定义一个spring注释注入
- spring注释注入
- 【JAVA】Spring 自动注入类注释详解
- 关于spring的配置注入和注释注入的见解
- spring bean定义和自动注入
- Spring 学习2--Spring特殊语义注释类定义bean
- 【j2ee spring】1、使用注释@Resource进行注入
- 【j2ee spring】2、深入理解注释@Resource注入
- 一个关于Spring注入java程序
- Spring @Autowired 注入的一个小技巧
- 关于spring依赖注入的一个知识点
- Spring 一个接口多个实现注入
- Spring定义bean的三种方式和自动注入
- Spring定义bean的三种方式和自动注入
- Spring:如何完整定义一个Bean
- 注释方式注入datasource
- SQL注入之注释
- spring注入:构造注入
- cocos2d-Lua03环境搭建及基本概念
- linux下打开core功能,以便于通过gdb查看出错堆栈信息
- 随笔---java中hashMap工作原理的总结
- C++实验3-多分数段函数求值
- Android中自定义SwipeRefreshLayout的实现
- 2016.4.07定义一个spring注释注入
- webRTC文档网址
- C++实验3—个人所得税计算器
- 4.4.2 single_server_accept_inet函数:接收网络请求
- 我也不知道他是第几次c++作业
- oracle创建dblink
- Lua协同程序
- 最后一节php+mysql的故事
- CentOS安装XRDP实现远程桌面访问