报错如下:
java.lang.IllegalArgumentException
at org.springframework.asm.ClassReader.<init>(Unknown Source)at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:52)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
ApplicationContext ac;
@Before
public void before(){
ac=new ClassPathXmlApplicationContext(new String[]{"spring.xml","spring-mybatis.xml"});//这句出错
// ac=new ClassPathXmlApplicationContext("classpath:/*.xml");
//换成上面这种方式会报org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'UserServiceImp' is defined
//可能是maven项目的classpath的问题,且先不管它
}
参考链接:https://stackoverflow.com/questions/31064967/java-lang-illegalargumentexception-at-org-springframework-asm-classreader-init;
bbs.csdn.net/topics/390964339
http://www.cnblogs.com/suibianle/p/4730450.html
解决办法:
一:把jdk版本换成1.7 or 1.7以下
二:使用spring 4.0RELEASE及以上版本
我的jdk是1.8以上的,我将spring相关的jar包全部换成4.2.5版本问题就解决了