org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceLayer' defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]: No matching factory method found: factory bean 'configurationClassPostProcessor'; factory method 'serviceLayer()'. Check that a method with the specified name exists and that it is non-static.

Spring JIRA | Adrian Moos | 5 years ago
  1. 0

    ConfigurationClassPostProcessor.processConfigBeanDefinitions assumes that bd.getBeanClassName() is the runtime type of that bean definition. This assumption doesn't appear to hold if the bean definition in question is a factory method (at least for a static factory method, bd.getBeanClassName() appears to hold the class containing the factory method, not its return type). As a consequence, trying to use the configuration class {code} @Configuration public class Application { @Bean DataAccessLayer dataAccessLayer() { return new DataAccessLayer(); } @Bean ServiceLayer serviceLayer() { return new ServiceLayer(dataAccessLayer()); } @Bean PresentationLayer presentationLayer() { return new PresentationLayer(serviceLayer()); } @Bean static ConfigurationClassPostProcessor configurationClassPostProcessor() { return new ConfigurationClassPostProcessor(); } } {code} results in {code} Information: Refreshing Root WebApplicationContext: startup date [Wed May 02 22:49:25 CEST 2012]; root of context hierarchy Mai 02, 2012 10:49:25 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext loadBeanDefinitions Information: Successfully resolved class for [ch.bedag.xyz.myapp.config.Application] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'dataAccessLayer': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=dataAccessLayer; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=configurationClassPostProcessor; factoryMethodName=dataAccessLayer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'serviceLayer': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=serviceLayer; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=configurationClassPostProcessor; factoryMethodName=serviceLayer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'presentationLayer': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=presentationLayer; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=configurationClassPostProcessor; factoryMethodName=presentationLayer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'configurationClassPostProcessor': replacing [Root bean: class [ch.bedag.xyz.myapp.config.Application]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=configurationClassPostProcessor; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [ch.bedag.xyz.myapp.config.Application]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=configurationClassPostProcessor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons Information: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@eb9101: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,configurationClassPostProcessor,serviceLayer,dataAccessLayer,presentationLayer]; root of factory hierarchy Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons Information: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@eb9101: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,configurationClassPostProcessor,serviceLayer,dataAccessLayer,presentationLayer]; root of factory hierarchy Mai 02, 2012 10:49:25 PM org.springframework.web.context.ContextLoader initWebApplicationContext Schwerwiegend: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceLayer' defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]: No matching factory method found: factory bean 'configurationClassPostProcessor'; factory method 'serviceLayer()'. 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) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) {code} The post-processor's inability to cope with factory methods also prevents it from enhancing DataAccessLayer and friends, which was why I configured the PostProcessor in the first place ... I guess I should fall back to Component Scanning to discover the configuration classes, and use @Autowired to wire them up.

    Spring JIRA | 5 years ago | Adrian Moos
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceLayer' defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]: No matching factory method found: factory bean 'configurationClassPostProcessor'; factory method 'serviceLayer()'. Check that a method with the specified name exists and that it is non-static.
  2. 0

    ConfigurationClassPostProcessor.processConfigBeanDefinitions assumes that bd.getBeanClassName() is the runtime type of that bean definition. This assumption doesn't appear to hold if the bean definition in question is a factory method (at least for a static factory method, bd.getBeanClassName() appears to hold the class containing the factory method, not its return type). As a consequence, trying to use the configuration class {code} @Configuration public class Application { @Bean DataAccessLayer dataAccessLayer() { return new DataAccessLayer(); } @Bean ServiceLayer serviceLayer() { return new ServiceLayer(dataAccessLayer()); } @Bean PresentationLayer presentationLayer() { return new PresentationLayer(serviceLayer()); } @Bean static ConfigurationClassPostProcessor configurationClassPostProcessor() { return new ConfigurationClassPostProcessor(); } } {code} results in {code} Information: Refreshing Root WebApplicationContext: startup date [Wed May 02 22:49:25 CEST 2012]; root of context hierarchy Mai 02, 2012 10:49:25 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext loadBeanDefinitions Information: Successfully resolved class for [ch.bedag.xyz.myapp.config.Application] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'dataAccessLayer': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=dataAccessLayer; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=configurationClassPostProcessor; factoryMethodName=dataAccessLayer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'serviceLayer': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=serviceLayer; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=configurationClassPostProcessor; factoryMethodName=serviceLayer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'presentationLayer': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=presentationLayer; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=configurationClassPostProcessor; factoryMethodName=presentationLayer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Information: Overriding bean definition for bean 'configurationClassPostProcessor': replacing [Root bean: class [ch.bedag.xyz.myapp.config.Application]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=configurationClassPostProcessor; initMethodName=null; destroyMethodName=(inferred); defined in class ch.bedag.xyz.myapp.config.Application] with [Root bean: class [ch.bedag.xyz.myapp.config.Application]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=configurationClassPostProcessor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]] Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons Information: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@eb9101: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,configurationClassPostProcessor,serviceLayer,dataAccessLayer,presentationLayer]; root of factory hierarchy Mai 02, 2012 10:49:25 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons Information: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@eb9101: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,configurationClassPostProcessor,serviceLayer,dataAccessLayer,presentationLayer]; root of factory hierarchy Mai 02, 2012 10:49:25 PM org.springframework.web.context.ContextLoader initWebApplicationContext Schwerwiegend: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceLayer' defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]: No matching factory method found: factory bean 'configurationClassPostProcessor'; factory method 'serviceLayer()'. 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) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) {code} The post-processor's inability to cope with factory methods also prevents it from enhancing DataAccessLayer and friends, which was why I configured the PostProcessor in the first place ... I guess I should fall back to Component Scanning to discover the configuration classes, and use @Autowired to wire them up.

    Spring JIRA | 5 years ago | Adrian Moos
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceLayer' defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]: No matching factory method found: factory bean 'configurationClassPostProcessor'; factory method 'serviceLayer()'. Check that a method with the specified name exists and that it is non-static.
  3. 0

    Remove Annotation @Configuration for xml configure by kinorsi · Pull Request #547 · springfox/springfox · GitHub

    github.com | 7 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'swaggerConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.mykidedu.base.SwaggerConfig.setSpringSwaggerConfig(com.mangofactory.swagger.configuration.SpringSwaggerConfig); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.mangofactory.swagger.configuration.SpringSwaggerConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.List com.mangofactory.swagger.configuration.SpringSwaggerConfig.handlerMappings; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] found for dependency [collection of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: { .springframework.beans.factory.annotation.Autowired(required=true)}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Can't get tomcat define a datasource

    Stack Overflow | 3 years ago | Roberto Pastrello
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#5' while setting bean property 'sourceList' with key [5]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#5': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#1' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#1': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService' defined in ServletContext resource [/WEB-INF/security-app-context.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/persistence-context.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [ChecchinDB] is not bound in this Context. Unable to find [ChecchinDB].
  6. 0

    Spring unable to pick Autowired implementation by profile

    Stack Overflow | 3 years ago | Dave
    org.springframework.beans.factory.BeanCreationException: Could not autowire field: private dkwestbr.spring.autowired.example.IString Getter dkwestbr.spring.autowired.example.WebEndpoint.getTheThing; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionExcepti on: No qualifying bean of type [dkwestbr.spring.autowired.example.IStringGetter] is defined: expected single matching bean but found 2: a,b

  1. ggghjh 1 times, last 5 months ago
  2. Amol 1 times, last 11 months ago
  3. Andreas Häber 2 times, last 1 month ago
  4. wendellpereira 12 times, last 2 months ago
  5. marcbouvierdav 7 times, last 3 months ago
1 more registered users
94 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.beans.factory.BeanCreationException

    Error creating bean with name 'serviceLayer' defined in class path resource [ch/bedag/xyz/myapp/config/Application.class]: No matching factory method found: factory bean 'configurationClassPostProcessor'; factory method 'serviceLayer()'. Check that a method with the specified name exists and that it is non-static.

    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod()
  2. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:528)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    6. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    7. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    8. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    9. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    10. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    10 frames
  3. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    2 frames
  4. Spring
    ContextLoaderListener.contextInitialized
    1. org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
    2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
    3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    3 frames
  5. Glassfish Core
    ContainerBase$StartChild.call
    1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
    2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
    3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    4. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    5. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    5 frames
  6. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:166)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    5. java.lang.Thread.run(Thread.java:722)
    5 frames