Announcement Announcement Module
Collapse
No announcement yet.
why been injected into other beans in its raw version? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • why been injected into other beans in its raw version?

    Hi,

    I wrote an aspect
    Code:
    @Aspect
    public class LogExceptionAspect {
        @Around("@target(s)")
        public Object log(ProceedingJoinPoint pjp, SomeMarker s) throws Throwable {
            //logging goes here
        }
    }
    I added it to my application-context.xml
    as well as <aop:aspectj-autoproxy /> tag.
    Beside my aspect I have DataSource and HibernateSessionFactory defined.

    If I try to initialize application context I receive an exception with following message:

    Error creating bean with name 'dataSource': Bean with name 'dataSource' has been injected into other beans [sessionFactory] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.

    If I replace pointcut with the following
    Code:
    @Around("@target(s)&&within(my.packages.only..*)")
    everything works fine.

    The question is - Why SpringAOP considers that dataSource bean has been wrapped as a part of auto-proxy creation?

    Regards
Working...
X