org.springframework.beans.factory.BeanCreationException: Error creating bean with name ” defined in class path resource [.xml]: No matching factory method found on class []: factory method ‘aspectOf()’. Check that a method with the specified name exists and that it is static.

Recently on upgrading for spring 4 to spring 5 we encountered the below error.

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '' defined in class path resource [.xml]: No matching factory method found on class []: factory method 'aspectOf()'. Check that a method with the specified name exists and that it is static.
            at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:614)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)

Solution was to update the aspectj version to 

<aspectj.version>1.9.9.1</aspectj.version>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.