十月 16, 2015 7:29:21 上午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4b85612c: startup date [Fri Oct 16 07:29:21 CST 2015]; root of context hierarchy
十月 16, 2015 7:29:22 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [bean.xml]
十月 16, 2015 7:29:22 上午 org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
信息: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Exception in thread "main" 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)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:298)
at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:230)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:153)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at org.itee.test.TestSimpleDial.main(TestSimpleDial.java:9)
注释掉annotation后使用XML配置AOP是运行正确的,但使用annotation注释配置如上报错
JDK1.8环境下需使用Spring4.0以上版本
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd">改为
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.BJ.hello</groupId>
<artifactId>SImpleD</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SImpleDMavenWebapp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>SImpleD</finalName>
</build>
</project>
base-package="org.itee"
试试
base-package="org.itee"
试试
项目SImpleD压缩包文件我已上传到百度网盘,分享地址:http://pan.baidu.com/s/1uQAb8望好心人帮助,猪头老师今天下午就要收作业了,我已经尽力了,急急急Liming2015开始拨号。。。通话计时:15秒!!!
没报错啊!有问题 你私聊我 jspp@qq.com
总之,还是谢谢你的帮助,没有你的反馈,可能我也想不到会是JDK环境的问题XML配置是运行成功的,但注释配置下运行,我这边一直都报错,你是运行的注释配置吗 <beanid="person"class="org.itee.se.PersonImpl"><propertyname="name"value="Liming2015"/><propertyname="phone"ref="phone"/><propertyname="type"value="guest"/></bean><beanid="phone"class="org.itee.se.PhoneImpl"><propertyname="phoneType"value="HTCg14"/></bean><!--<beanid="aspectAdvice"class="org.itee.aoptest.advice.AspectAdvice"/><beanid="aspectAdvice2"class="org.itee.aoptest.advice.AspectAdvice2"/><aop:config><aop:aspectid="springAspect1"ref="aspectAdvice"><aop:pointcutexpression="execution(*org.itee.se.PhoneImpl.call(..))"id="PhoneImpl"/><aop:aroundmethod="doAround"pointcut-ref="PhoneImpl"/></aop:aspect></aop:config><aop:config><aop:aspectid="springAspect2"ref="aspectAdvice2"><aop:aroundmethod="doAround"pointcut="execution(*org.itee.se.PersonImpl.dial(..))"/><aop:beforemethod="doBefore"pointcut="execution(*org.itee.se.PersonImpl.dial(..))"/></aop:aspect></aop:config>--><context:component-scanbase-package="org.itee"/><aop:aspectj-autoproxy/>版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。