Idea java ssm maven 项目 spring事务无法使用

当在使用ssm项目的时候,事务无法正常使用

在网上看到很多这种错误
都是SqlSession was not registered for synchronization because synchronization is not active和 JDBC Connection will not be managed by Spring。但是没有适合我的答案,一直百思不得其解,无法解决。不知道有没有大神为我解惑~

这个报错是在查询的时候:

2017-09-04 11:16:04,520 [http-nio-8091-exec-1] [org.mybatis.spring.SqlSessionUtils]-[DEBUG] Creating a new SqlSession
2017-09-04 11:16:04,536 [http-nio-8091-exec-1] [org.mybatis.spring.SqlSessionUtils]-[DEBUG] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@124f114b] was not registered for synchronization because synchronization is not active
2017-09-04 11:16:04,631 [http-nio-8091-exec-1] [org.springframework.jdbc.datasource.DataSourceUtils]-[DEBUG] Fetching JDBC Connection from DataSource
2017-09-04 11:16:04,668 [http-nio-8091-exec-1] [com.alibaba.druid.pool.DruidDataSource]-[INFO] {dataSource-1} inited
2017-09-04 11:16:04,953 [http-nio-8091-exec-1] [org.mybatis.spring.transaction.SpringManagedTransaction]-[DEBUG] JDBC Connection [com.mysql.jdbc.JDBC4Connection@6dbec1f0] will not be managed by Spring
2017-09-04 11:16:04,957 [http-nio-8091-exec-1] [mapper.AmazonImportConfigureMapper.selectByExample]-[DEBUG] ==>  Preparing: select ID, CREATED_AT, CREATED_ID, UPDATED_AT, UPDATED_ID, ISACTIVE, STATE, CLIENT_ID, ORG_ID, BPARTNER_ID, DOCTYPE_ID, DOCTYPETARGET_ID, PROJECT_ID, PRICELIST_ID, WAREHOUSE_ID, URL, MWS_ACCESS_KEY, MWS_MARKETPLACE_ID, MWS_SECRET_KEY, MWS_SELLER_ID, SALESREP_ID, SELF_WAREHOUSE_ID, TIME_ZONE, AMAZON_SALES_CHANNEL, IS_NONAMAZON_INCLUDED, TYPE, STORENAME_EB from amazon_import_configure WHERE ( IS_NONAMAZON_INCLUDED = ? ) 
2017-09-04 11:16:04,980 [http-nio-8091-exec-1] [mapper.AmazonImportConfigureMapper.selectByExample]-[DEBUG] ==> Parameters: Y(String)
2017-09-04 11:16:05,004 [http-nio-8091-exec-1] [mapper.AmazonImportConfigureMapper.selectByExample]-[DEBUG] <==      Total: 1
2017-09-04 11:16:05,005 [http-nio-8091-exec-1] [org.mybatis.spring.SqlSessionUtils]-[DEBUG] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@124f114b]
2017-09-04 11:16:05,005 [http-nio-8091-exec-1] [org.springframework.jdbc.datasource.DataSourceUtils]-[DEBUG] Returning JDBC Connection to DataSource

上网找了很多解答,但是一直找不到我想要的答案。
有的问题是重复扫描了controller和service。但是我的资源文件似乎并没有重复
我的资源文件目录如下:
这里写图片描述

applicationContext-dao.xml:
这里写图片描述

applicationContext-service.xml
这里写图片描述

applicationContext-trans.xml
这里写图片描述

springmvc.xml
这里写图片描述

pom.xml

<properties>
        <junit.version>4.12</junit.version>
        <spring.version>4.1.3.RELEASE</spring.version>
        <mybatis.version>3.2.8</mybatis.version>
        <mybatis.spring.version>1.2.2</mybatis.spring.version>
        <mybatis.paginator.version>1.2.15</mybatis.paginator.version>
        <mysql.version>5.1.32</mysql.version>
        <slf4j.version>1.6.4</slf4j.version>
        <jackson.version>2.4.2</jackson.version>
        <druid.version>1.0.9</druid.version>
        <httpclient.version>4.3.5</httpclient.version>
        <jstl.version>1.2</jstl.version>
        <servlet-api.version>2.5</servlet-api.version>
        <jsp-api.version>2.0</jsp-api.version>
        <joda-time.version>2.5</joda-time.version>
        <commons-lang3.version>3.3.2</commons-lang3.version>
        <commons-io.version>1.3.2</commons-io.version>
        <commons-net.version>3.3</commons-net.version>
        <pagehelper.version>3.4.2</pagehelper.version>
        <jsqlparser.version>0.9.1</jsqlparser.version>
        <commons-fileupload.version>1.3.1</commons-fileupload.version>
        <jedis.version>2.7.2</jedis.version>
        <solrj.version>4.10.3</solrj.version>
        <quartz.version>2.2.2</quartz.version>
    </properties>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值