![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring
Clearlove7·11
坚持一定有所得,永远不要让自己停止美好
展开
-
@Resource注解和@Autowired注解使用时的区别
首先,@Resource注解是java自带注解,@Autowired注解来源于spring1)@AutoWired 和 @Resource都可以添加在属性和set方法上@AutoWired 可以添加在构造方法上@Resource 不能添加在构造方法上2)@AutoWired 默认根据类型匹配 (或者类型的子类匹配)默认情况下,要求依赖的对象必须存在,如果要允许null值,可以设置它的required属性为false, 如@Autowired(required=false)...原创 2020-06-03 14:57:48 · 558 阅读 · 0 评论 -
spring整合myabtis异常之Invocation of destroy method 'close' failed on bean with name 'sqlSessionTemplate'
1、异常描述spring和myabtis整合时,出现以下异常:-Invocation of destroy method 'close' failed on bean with name 'sqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spr...原创 2019-07-18 19:53:13 · 4314 阅读 · 2 评论 -
Spring框架之@Transactional注解用法(一)
一、用法简介@Transactional注解是spring的核心思想AOP(面向切面编程)的体现。它可以结合事务管理器类帮助我们更好地管理事务。以spring和mybatis的整合为例。二、环境配置1、maven项目的目录结构2、pom.xml(只列出部分配置) <!-- spring jar --> <dependency&...原创 2019-07-23 16:24:53 · 546 阅读 · 3 评论 -
Spring框架之@Transactional注解用法(二)
1、@Transactional注解中的属性设置属性 类型 描述 value String 可选限定符,指定要使用的事务管理器。 propagation 枚举:Propagation 可选的传播设置。 isolation 枚举:Isolation 可选隔离级别。仅适用于传播REQUIRED或REQUIRES_NEW。 time...原创 2019-07-23 17:46:40 · 249 阅读 · 0 评论 -
Spring框架之@Transactional注解用法(三)之timeout属性的使用
1、业务逻辑层代码@Servicepublic class UserServiceImpl implements UserService{ // 加载mapper @Autowired private UserMapper usermapper; @Transactional(propagation=Propagation.REQUIRED,timeout=5) // 启用事...原创 2019-07-23 18:15:29 · 10039 阅读 · 0 评论 -
Spring+mybatis整合声明式事务异常之org.springframework.transaction.TransactionTimedOutException: Transaction ..
1、异常信息org.springframework.transaction.TransactionTimedOutException: Transaction timed out: deadline was Tue Jul 23 18:06:32 CST 2019...2、示例代码@Servicepublic class UserServiceImpl implements ...原创 2019-07-23 18:24:43 · 11281 阅读 · 9 评论 -
spring异常之: No tests found matching [{ExactMatcher:fDisplayName=testInjection], {ExactMatcher:fDis...
spring和junit整合测试java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testInjection],{ExactMatcher:fDisplayName=testInjection(testJection.TestJection)],{LeadingIdentifierMatch...原创 2019-07-17 14:55:08 · 519 阅读 · 0 评论