Invoking destroy method 'close' on bean with name 'dataSource'

解决Spring Mybatis整合问题
本文分享了在Spring与Mybatis整合过程中遇到的一个常见问题——属性配置错误导致的Invoking destory method 'close' on bean with name 'dataSource'异常,并提供了相应的解决方法。

Invoking destroy method 'close' on bean with name 'dataSource'

  • Spring与Mybatis整合时出现的问题,找了一晚上结果是一个属性写错了,在 .xml 中配置属性时,应该格外注意各个标签、各个属性。


    1080293-20180612001110172-719871844.jpg


    1080293-20180612001141600-2018925625.jpg


    1080293-20180612001455732-1851928274.jpg

转载于:https://www.cnblogs.com/renxiuxing/p/9170710.html

2025-10-22 22:02:26 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' processing GET request for [/list] 2025-10-22 22:02:26 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /list 2025-10-22 22:02:26 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:02:26 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean 'userController' 2025-10-22 22:02:26 DEBUG DispatcherServlet:951 - Last-Modified value for [/list] is: -1 22:02:26.568 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:02:26.573 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@40a594c4] was not registered for synchronization because synchronization is not active 2025-10-22 22:02:26 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:02:26.613 [http-nio-8080-exec-2] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hgeirabe3e4xhqer7gp8|3b2a5f67, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgeirabe3e4xhqer7gp8|3b2a5f67, idleConnectionTestPeriod -> 300, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/as3?serverTimezone=UTC&seUnicode=true&characterEncoding=utf8&useSSL=false, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 22:02:26.628 [http-nio-8080-exec-2] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier '/mchange-commons.properties' could not be found. Skipping. 22:02:26.628 [http-nio-8080-exec-2] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier '/mchange-log.properties' could not be found. Skipping. 22:02:26.628 [http-nio-8080-exec-2] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping. 22:02:26.628 [http-nio-8080-exec-2] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping. 22:02:26.628 [http-nio-8080-exec-2] WARN com.mchange.v2.resourcepool.BasicResourcePool - Bad pool size config, start 3 < min 5. Using 5 as start. 22:02:26.630 [http-nio-8080-exec-2] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - com.mchange.v2.resourcepool.BasicResourcePool@49a00888 config: [start -> 5; min -> 5; max -> 20; inc -> 3; num_acq_attempts -> 30; acq_attempt_delay -> 1000; check_idle_resources_delay -> 300000; max_resource_age -> 0; max_idle_time -> 0; excess_max_idle_time -> 0; destroy_unreturned_resc_time -> 0; expiration_enforcement_delay -> 0; break_on_acquisition_failure -> false; debug_store_checkout_exceptions -> false; force_synchronous_checkins -> false] 22:02:26.630 [http-nio-8080-exec-2] DEBUG com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager - Created new pool for auth, username (masked): 'ro******'. 22:02:26.630 [http-nio-8080-exec-2] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - acquire test -- pool size: 0; target_pool_size: 5; desired target? 1 22:02:26.630 [http-nio-8080-exec-2] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - awaitAvailable(): [unknown] 22:02:26.843 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@efcbda1 [wrapping: com.mysql.jdbc.JDBC4Connection@7f63eef7]] will not be managed by Spring 22:02:26.849 [http-nio-8080-exec-2] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:02:26.870 [http-nio-8080-exec-2] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:02:26.893 [http-nio-8080-exec-2] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:02:26.898 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@40a594c4] 2025-10-22 22:02:26 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name='111', email=11111}]jgeydugwu 2025-10-22 22:02:26 DEBUG DefaultListableBeanFactory:1631 - Invoking afterPropertiesSet() on bean with name 'userList' 2025-10-22 22:02:26 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:02:26 DEBUG JstlView:432 - Added model object 'userList' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:02:26 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:02:26 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' processing GET request for [/userList.html] 2025-10-22 22:02:26 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:02:26 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:02:26 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:02:26 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:02:26 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@6d15109c]]] and 1 interceptor 2025-10-22 22:02:26 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:02:26 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name 'springMVC': assuming HandlerAdapter completed request handling 2025-10-22 22:02:26 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:02:26 DEBUG DispatcherServlet:1000 - Successfully completed request
最新发布
10-23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值