Service测试出现错误
来源:2-9 验证Sevice
司音子衿
2021-01-29




我用视频的方法就一直null,我数据库里面也有数据,classpath路径也是对的。之前Dao测试都没问题。我直接打印就没有错误
4回答
-
司音子衿
提问者
2021-01-29
老师已解决,我在spring-dao文件里面不小心把mybatis给注释掉了
10 -
司音子衿
提问者
2021-01-29
老师,我找到问题了是因为<setting name="mapUnderscoreToCamelCase" value="true" />没生效,我把areaDao.xml查询语句中的area_name改成areaname,数据库也改成areaname。就能查到数据。这个问题该怎么处理?
00 -
司音子衿
提问者
2021-01-29
1月 29, 2021 1:38:30 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
1月 29, 2021 1:38:30 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@6b1274d2, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7bc1a03d, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@70b0b186, org.springframework.test.context.support.DirtiesContextTestExecutionListener@ba8d91c, org.springframework.test.context.transaction.TransactionalTestExecutionListener@7364985f, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@5d20e46]
1月 29, 2021 1:38:30 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]
1月 29, 2021 1:38:30 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring/spring-service.xml]
1月 29, 2021 1:38:30 下午 org.springframework.context.support.GenericApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.GenericApplicationContext@1a0dcaa: startup date [Fri Jan 29 13:38:30 CST 2021]; root of context hierarchy
1月 29, 2021 1:38:30 下午 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
1月 29, 2021 1:38:31 下午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
13:38:31.369 [main] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
13:38:31.382 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration
13:38:31.433 [main] DEBUG org.apache.ibatis.io.VFS - Class not found: org.jboss.vfs.VFS
13:38:31.434 [main] DEBUG org.apache.ibatis.io.JBoss6VFS - JBoss 6 VFS API is not available in this environment.
13:38:31.435 [main] DEBUG org.apache.ibatis.io.VFS - Class not found: org.jboss.vfs.VirtualFile
13:38:31.436 [main] DEBUG org.apache.ibatis.io.VFS - VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
13:38:31.437 [main] DEBUG org.apache.ibatis.io.VFS - Using VFS adapter org.apache.ibatis.io.DefaultVFS
13:38:31.442 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Scanned package: 'com.imooc.entity' for aliases
13:38:31.527 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'file [D:\Eclipse\o2o\target\classes\mapper\AreaDao.xml]'
13:38:31.676 [main] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession
13:38:31.702 [main] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@e041f0c] was not registered for synchronization because synchronization is not active
1月 29, 2021 1:38:31 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 10000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hgeby9afl9mwo112kvupu|3adcc812, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgeby9afl9mwo112kvupu|3adcc812, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/o2o?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {password=******, user=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
13:38:32.165 [main] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@130a0f66] will not be managed by Spring
13:38:32.220 [main] DEBUG com.imooc.o2o.dao.AreaDao.queryArea - ==> Preparing: SELECT area_id, area_name, priority, create_time, last_edit_time FROM tb_area ORDER BY priority DESC
13:38:32.305 [main] DEBUG com.imooc.o2o.dao.AreaDao.queryArea - ==> Parameters:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/C:/Users/lenovo/.m2/repository/org/mybatis/mybatis/3.4.2/mybatis-3.4.2.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
13:38:32.345 [main] DEBUG com.imooc.o2o.dao.AreaDao.queryArea - <== Total: 2
13:38:32.352 [main] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@e041f0c]
00 -
司音子衿
提问者
2021-01-29
我把Area.xml那段查询语句,放到mysql里面能查到数据。然后我故意写get(-1),就会告诉我指针错误。它能查到数据库有2条数据,但是显示不出来西苑
00
相似问题