Tag Archives: Dyf Spring boot startup error

Dyf Spring boot startup error: NoSuchBeanDefinitionException

When starting springboot, autowired automatically injects an error,

2017-05-26 15:23:05.761  WARN 46372 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongoTest': Unsatisfied dependency expressed through field 'mongoDaoTest'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'mongo.MongoDaoTest' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2017-05-26 15:23:05.764  INFO 46372 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
2017-05-26 15:23:05.789  INFO 46372 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-26 15:23:05.891 ERROR 46372 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field mongoDaoTest in mongo.MongoTest required a bean of type 'mongo.MongoDaoTest' that could not be found.


Action:

Consider defining a bean of type 'mongo.MongoDaoTest' in your configuration.

 

Will prompt injection failure, you can try to replace @EnableAutoConfiguration annotation with @SpringBootApplication;

@SpringBootApplication annotation effect is equivalent to @Configuration, @EnableAutoConfiguration and @ComponentScan these three annotations are used together, so do not add @EnableAutoConfiguration to the Controller