欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

架构师之maven(三)---------junit测试可能遇到的问题

程序员文章站 2022-03-01 21:44:21
...
1.前言.
  如题.
2.代码.
(1)类型转换错误
(1)问题描述
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum const class org.apache.ibatis.type.JdbcType.Integer


解决办法
Integer 改为INTEGER 这个是个枚举,和大小写有关-_-!

(2)无法autowire.
很可能你的工程的pom没有引入配置文件xml等.pom.xml的build节点加上.
<build>
  		<plugins>
  			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>cobertura-maven-plugin</artifactId>
				<version>2.5.1</version>
			</plugin>
			
  			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
  		</plugins>
  		
		<filters>
			<filter>src/main/filter/${env}.properties</filter>
		</filters>
		<resources>
		<resource>
			<directory>src/main/resources</directory>
				<includes>
					<include>**/*.properties</include>
					<include>**/*.xml</include>
					<include>**/*.ftl</include>
				</includes>
				<filtering>true</filtering>
			</resource>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**/*.xml</include>
				</includes>
				<filtering>true</filtering>
			</resource>
		</resources>
	</build>


(3)不是类问题,始终imcomlabe class报错.
  maven update--->看test类是不是在builder folder里面--->检查service或者mapper是不是有语法错误--->数据库或者xml是否正确--->再执行下.