关于spring、pringmvc整合时注解扫描
2016-08-05 17:09
459 查看
一般都设置springmvc.xml只让扫@controller注解
spring.xml不让扫@controller注解
(貌似这样可以避免一些事务上的问题)
具体配置如下:
springmvc.xml:
注意:不要漏掉user-default-filters=”false”(默认为”true”),否则不起作用(还是会去扫描其他@service等注解)。
springcontext.xml:
可参考内容:
http://jinnianshilongnian.iteye.com/blog/1762632
spring.xml不让扫@controller注解
(貌似这样可以避免一些事务上的问题)
具体配置如下:
springmvc.xml:
<!-- 使用Annotation自动注册Bean,只扫描@Controller --> <context:component-scan base-package="com.***(具体扫描那些包).***" use-default-filters="false"><!-- base-package 如果多个,用“,”分隔 --> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan>
注意:不要漏掉user-default-filters=”false”(默认为”true”),否则不起作用(还是会去扫描其他@service等注解)。
springcontext.xml:
<!-- 使用Annotation自动注册Bean,解决事物失效问题:在主容器中不扫描@Controller注解,在SpringMvc中只扫描@Controller注解。 --> <context:component-scan base-package="com.thinkgem.jeesite,com.wonders"><!-- base-package 如果多个,用“,”分隔 --> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan>
可参考内容:
http://jinnianshilongnian.iteye.com/blog/1762632
相关文章推荐
- 关于spring mvc Controller的几个注解
- spring mvc高级篇(八):Spring+SpringMVC+Mybatis整合(采用泛型和注解优化)
- springMVC+activemq整合注解方式
- Spring+SpringMVC+mybatis+easyui整合实例(二)注解方式的mybatis的使用
- 关于spring mvc Controller的几个注解
- 关于spring+springmvc+mybatis+maven的框架整合实例
- 详解注解配置整合Spring MVC+Thymeleaf整合实例
- spring+springmvc+ibatis整合注解方式实例
- 关于搭建restful web service + springMVC + ibatis/hibernate的整合和XML配置意思和ssh+springMVC框架搭建
- springmvc+spring+hibernate 整合 annotation(全注解)方式
- 关于spring+springMVC+myBatis的一些基础配置以及整合
- 关于spring-mvc的InitBinder注解的参数
- 关于spring+springMVC+myBatis的一些基础配置以及整合
- springMVC+hibernate+jdbc+mybatis整合 支持全注解方式 支持全配置方式
- spring+springmvc+ibatis整合注解方式实例
- spring+springmvc+ibatis整合注解方式实例
- spring mvc高级篇(三):Spring+SpringMVC+Hibernate整合(采用注解优化)
- spring+sprinmvc+mybatis基本整合(二)--基于spring注解mybais非注解非Mapper接口方式
- 关于IDEA中maven整合mybatis+spring+springMVC项目中mapper文件找不到问题的解决方案(org.apache.ibatis.binding.BindingExcepti
- spring+springmvc+ibatis整合注解方式实例(附带数据库)