异常信息: xml 文件配置注解时报错
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalRequiredAnnotationProcessor': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]:
Constructor threw exception; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: cn.itcast.service.imple.AopServiceBean3 [Xlint:invalidAbsoluteTypeName]
原因:
applicatonContext.xml
<aop:config>
<aop:aspect id="asp" ref="myInterceptor1">
<!--<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3..*(..))" />--> 正确的
<!--<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*.*(..))" />-->正确的
<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3..*.*(..))" />正确的
<!--下面的配置有问题AopServiceBean3.*(..)-->
<!--<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*(..))" />-->错误的
<aop:before method="doAccessCheck" pointcut-ref="mycut"/>
</aop:aspect>
如用注解:
@Pointcut("execution (* cn.itcast.aop.service.imple..*.*(..))") //imple包下所有类的所有方法进行拦截
//@Pointcut("execution (* cn.itcast.aop.service.imple.AopServiceBean2.*(..))")只对AopServiceBean2类下方法进行拦截
有一个问题没有搞明白:为什么注解和配置一样会报错?
annotation:::::::<!--<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*(..))" />-->错误的
xml:::::::::::::::::::://@Pointcut("execution (* cn.itcast.aop.service.imple.AopServiceBean2.*(..))")只对AopServiceBean2类下方法进行拦截 正确的
参考文章:
http://hi.baidu.com/gglzf4/blog/item/424bd5d761d23b2006088b1b.html
http://blog.csdn.net/sustbeckham/article/details/5819213
分享到:
相关推荐
org.springframework.web.bind.annotation.SessionAttributes.class org.springframework.web.bind.support.ConfigurableWebBindingInitializer.class org.springframework.web.bind.support....
5. **排序与比较**:`org.springframework.core.order`和`org.springframework.core.type`包提供了排序算法和类型比较机制,对于Spring容器中bean的排序和类型检查起到了关键作用。 6. **事件驱动**:`org.spring...
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.class org.springframework.test.annotation.DirtiesContext.class org.springframework.test.annotation.ExpectedException.class...
6. `org.springframework.core.annotation`: 包含了对Java注解的处理,如`MergedAnnotations`接口,用于合并和检索注解信息,是Spring元数据解析的关键部分。 7. `org.springframework.core.type`: 提供了类型扫描...
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @...
### 关于 "org.springframework.orm.hibernate3.LocalSessionFactoryBean" 未找到问题的知识点解析 #### 一、问题背景 在开发基于Spring与Hibernate整合的应用时,可能会遇到“`org.springframework.orm.hibernate...
spring mvc 开发的必须有的架包org.springframework.web.servlet-3.0.5.RELEASE.jar
### 关于 `org.springframework.dao.InvalidDataAccessApiUsageException` 的深入解析 在Spring与Hibernate集成开发过程中,开发者可能会遇到各种各样的异常问题。其中一种较为常见的异常是 `org.springframework....
org.springframework.web.servlet-3.0.0.M4.jar
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org....
org.springframework.transaction-3.0.0.M4.jar
错误五:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping' 错误原因:...
The import org.springframework.web.bind.annotation cannot be resolved. json.jar spring.jar mail.jar log4j.jar
import org.springframework.context.annotation.Bean; import org.springframework.web.filter.HiddenHttpMethodFilter; @SpringBootApplication public class WmsApplication { public static void main(String...
org.springframework.beans.annotation org.springframework.beans.factory org.springframework.beans.factory.access org.springframework.beans.factory.access.el org.springframework.beans.factory.annotation...
org.springframework.osgi.extensions.annotation-1.2.1.jar
14. <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> 15. 16. <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 --> 17. <bean class="org....
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java....
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <!-- 匹配...
在Java编程环境中,有时我们可能会遇到“java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Around”的错误,这通常意味着运行时环境无法找到特定的类,即`org.aspectj.lang.annotation.Around`。...