Announcement Announcement Module
No announcement yet.
Strange behaviour of point-cut with annotation Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange behaviour of point-cut with annotation

    I have my own annotation:
    public @interface ExceptionalController
        String test() default "test";
    and aspect in spring context:
            <aop:aspect id="exceptionAspect" ref="exceptionInterceptor">
                <aop:pointcut id="controllers" expression="@target(ExceptionalController)"/>
                <aop:around method="interceptException" pointcut-ref="controllers"></aop:around>
    I try to deploy my project to Tomcat without labeling anything by my annotation, and get following error during servlet initialization:

    8.03.2009 0:02:50 org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in ServletContext resource [/WEB-INF/applicationContext-services.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.LinkedHashMap] to
    required type [java.util.Map] for property 'actions'; nested exception is java.lang.ClassCastException: $Proxy21 cannot be cast to actions.AbstractAction
    Class AbstractAction is my own class without any annotation or Spring depended features. It is only declared as bean.
    What's I do wrong?
    And is there any possibility to use annotations for Spring AOP if I want to use Spring Web MVC controllers as target objects? I think it could be some difficulties because of using proxies and reflection in Web MVC. Am I right?
    What is the best way for using aspects for my case?