Home  >  Forum  >  Spring
Post New Query

Check that a method with the specified name exists and that it is non-static.

joined on
April 07,2013
Asked on April 07,2013
Hi All,

I am new to spring. I am running factory class to initialize bean and getting below exception. Help me to resolve the issue. 
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountService' defined in class path resource [spring-config.xml]: No matching factory method found: factory bean 'defaultServiceFactory'; factory method 'createAccountService()'. Check that a method with the specified name exists and that it is non-static.
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:528)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

joined on
March 18,2013
Replied on April 07,2013

It is very obvious with the error message that in your factory class, You have done some mistake. Either you have no such method are you have created static method to create bean. You need to keep it non-static. Find the URL for the refernace.

Write Answer


Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us