Consider defining a bean of type 'com.lvjing.dao.DeviceStatusMapper' in your configuration.(

高斋晓开卷,独共圣人语。这篇文章主要讲述Consider defining a bean of type ' com.lvjing.dao.DeviceStatusMapper' in your configuration.(相关的知识,希望能为你提供帮助。
"C:Program Filesjavajdk1.8.0_181injava.exe" "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.4libidea_rt.jar=55273:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.4in" -Dfile.encoding=UTF-8 -classpath "C:Program FilesJavajdk1.8.0_181jrelibcharsets.jar; C:Program FilesJavajdk1.8.0_181jrelibdeploy.jar; C:Program FilesJavajdk1.8.0_181jrelibextaccess-bridge-64.jar; C:Program FilesJavajdk1.8.0_181jrelibextcldrdata.jar; C:Program FilesJavajdk1.8.0_181jrelibextdnsns.jar; C:Program FilesJavajdk1.8.0_181jrelibextjaccess.jar; C:Program FilesJavajdk1.8.0_181jrelibextjfxrt.jar; C:Program FilesJavajdk1.8.0_181jrelibextlocaledata.jar; C:Program FilesJavajdk1.8.0_181jrelibext ashorn.jar; C:Program FilesJavajdk1.8.0_181jrelibextsunec.jar; C:Program FilesJavajdk1.8.0_181jrelibextsunjce_provider.jar; C:Program FilesJavajdk1.8.0_181jrelibextsunmscapi.jar; C:Program FilesJavajdk1.8.0_181jrelibextsunpkcs11.jar; C:Program FilesJavajdk1.8.0_181jrelibextzipfs.jar; C:Program FilesJavajdk1.8.0_181jrelibjavaws.jar; C:Program FilesJavajdk1.8.0_181jrelibjce.jar; C:Program FilesJavajdk1.8.0_181jrelibjfr.jar; C:Program FilesJavajdk1.8.0_181jrelibjfxswt.jar; C:Program FilesJavajdk1.8.0_181jrelibjsse.jar; C:Program FilesJavajdk1.8.0_181jrelibmanagement-agent.jar; C:Program FilesJavajdk1.8.0_181jrelibplugin.jar; C:Program FilesJavajdk1.8.0_181jrelib esources.jar; C:Program FilesJavajdk1.8.0_181jrelib t.jar; C:UsersLvjingServiceDocumentsEMQX_mongo_service argetclasses; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-data-mongodb2.1.2.RELEASEspring-boot-starter-data-mongodb-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter2.1.2.RELEASEspring-boot-starter-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot2.1.2.RELEASEspring-boot-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-autoconfigure2.1.2.RELEASEspring-boot-autoconfigure-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-logging2.1.2.RELEASEspring-boot-starter-logging-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar; C:UsersLvjingService.m2 epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar; C:UsersLvjingService.m2 epositoryorgapachelogginglog4jlog4j-to-slf4j2.11.1log4j-to-slf4j-2.11.1.jar; C:UsersLvjingService.m2 epositoryorgapachelogginglog4jlog4j-api2.11.1log4j-api-2.11.1.jar; C:UsersLvjingService.m2 epositoryorgslf4jjul-to-slf4j1.7.25jul-to-slf4j-1.7.25.jar; C:UsersLvjingService.m2 epositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar; C:UsersLvjingService.m2 epositoryorgyamlsnakeyaml1.23snakeyaml-1.23.jar; C:UsersLvjingService.m2 epositoryorgmongodbmongodb-driver3.8.2mongodb-driver-3.8.2.jar; C:UsersLvjingService.m2 epositoryorgmongodbson3.8.2son-3.8.2.jar; C:UsersLvjingService.m2 epositoryorgmongodbmongodb-driver-core3.8.2mongodb-driver-core-3.8.2.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkdataspring-data-mongodb2.1.4.RELEASEspring-data-mongodb-2.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-tx5.1.4.RELEASEspring-tx-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-context5.1.4.RELEASEspring-context-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-beans5.1.4.RELEASEspring-beans-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-expression5.1.4.RELEASEspring-expression-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkdataspring-data-commons2.1.4.RELEASEspring-data-commons-2.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-web2.1.2.RELEASEspring-boot-starter-web-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-json2.1.2.RELEASEspring-boot-starter-json-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositorycomfasterxmljacksoncorejackson-databind2.9.8jackson-databind-2.9.8.jar; C:UsersLvjingService.m2 epositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar; C:UsersLvjingService.m2 epositorycomfasterxmljacksoncorejackson-core2.9.8jackson-core-2.9.8.jar; C:UsersLvjingService.m2 epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.8jackson-datatype-jdk8-2.9.8.jar; C:UsersLvjingService.m2 epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.8jackson-datatype-jsr310-2.9.8.jar; C:UsersLvjingService.m2 epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.8jackson-module-parameter-names-2.9.8.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-tomcat2.1.2.RELEASEspring-boot-starter-tomcat-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgapache omcatembed omcat-embed-core9.0.14 omcat-embed-core-9.0.14.jar; C:UsersLvjingService.m2 epositoryorgapache omcatembed omcat-embed-el9.0.14 omcat-embed-el-9.0.14.jar; C:UsersLvjingService.m2 epositoryorgapache omcatembed omcat-embed-websocket9.0.14 omcat-embed-websocket-9.0.14.jar; C:UsersLvjingService.m2 epositoryorghibernatevalidatorhibernate-validator6.0.14.Finalhibernate-validator-6.0.14.Final.jar; C:UsersLvjingService.m2 epositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar; C:UsersLvjingService.m2 epositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar; C:UsersLvjingService.m2 epositorycomfasterxmlclassmate1.4.0classmate-1.4.0.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-web5.1.4.RELEASEspring-web-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-webmvc5.1.4.RELEASEspring-webmvc-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-aop5.1.4.RELEASEspring-aop-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgmybatisspringootmybatis-spring-boot-starter1.3.2mybatis-spring-boot-starter-1.3.2.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-jdbc2.1.2.RELEASEspring-boot-starter-jdbc-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositorycomzaxxerHikariCP3.2.0HikariCP-3.2.0.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-jdbc5.1.4.RELEASEspring-jdbc-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgmybatisspringootmybatis-spring-boot-autoconfigure1.3.2mybatis-spring-boot-autoconfigure-1.3.2.jar; C:UsersLvjingService.m2 epositoryorgmybatismybatis3.4.6mybatis-3.4.6.jar; C:UsersLvjingService.m2 epositoryorgeclipsepahoorg.eclipse.paho.client.mqttv31.2.0org.eclipse.paho.client.mqttv3-1.2.0.jar; C:UsersLvjingService.m2 epositorycomalibabafastjson1.2.7fastjson-1.2.7.jar; C:UsersLvjingService.m2 epositorymysqlmysql-connector-java5.1.39mysql-connector-java-5.1.39.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-core5.1.4.RELEASEspring-core-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-jcl5.1.4.RELEASEspring-jcl-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-integration2.1.2.RELEASEspring-boot-starter-integration-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkootspring-boot-starter-aop2.1.2.RELEASEspring-boot-starter-aop-2.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgaspectjaspectjweaver1.9.2aspectjweaver-1.9.2.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkintegrationspring-integration-core5.1.2.RELEASEspring-integration-core-5.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkspring-messaging5.1.4.RELEASEspring-messaging-5.1.4.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframework etryspring-retry1.2.3.RELEASEspring-retry-1.2.3.RELEASE.jar; C:UsersLvjingService.m2 epositoryioprojectreactor eactor-core3.2.5.RELEASE eactor-core-3.2.5.RELEASE.jar; C:UsersLvjingService.m2 epositoryorg eactivestreams eactive-streams1.0.2 eactive-streams-1.0.2.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkintegrationspring-integration-stream5.1.2.RELEASEspring-integration-stream-5.1.2.RELEASE.jar; C:UsersLvjingService.m2 epositoryorgspringframeworkintegrationspring-integration-mqtt5.1.2.RELEASEspring-integration-mqtt-5.1.2.RELEASE.jar" com.lvjing.Application
. ____ _ __ _ _
/\ / ___‘_ __ _ _(_)_ ____ _
( ( )\___ | ‘_ | ‘_| | ‘_ / _` |
\/___)| |_)| | | | | || (_| |) ) ) )
‘|____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::(v2.1.2.RELEASE)
2019-01-15 14:46:37.017INFO 91928 --- [main] com.lvjing.Application: Starting Application on DESKTOP-CFAH7O4 with PID 91928 (C:UsersLvjingServiceDocumentsEMQX_mongo_service argetclasses started by LvjingService in C:UsersLvjingServiceDocumentsEMQX_mongo_service)
2019-01-15 14:46:37.020INFO 91928 --- [main] com.lvjing.Application: No active profile set, falling back to default profiles: default
2019-01-15 14:46:37.871INFO 91928 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-01-15 14:46:37.909INFO 91928 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 34ms. Found 0 repository interfaces.
2019-01-15 14:46:38.134INFO 91928 --- [main] faultConfiguringBeanFactoryPostProcessor : No bean named ‘errorChannel‘ has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2019-01-15 14:46:38.141INFO 91928 --- [main] faultConfiguringBeanFactoryPostProcessor : No bean named ‘taskScheduler‘ has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2019-01-15 14:46:38.146INFO 91928 --- [main] faultConfiguringBeanFactoryPostProcessor : No bean named ‘integrationHeaderChannelRegistry‘ has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2019-01-15 14:46:38.478INFO 91928 --- [main] trationDelegate$BeanPostProcessorChecker : Bean ‘org.springframework.integration.config.IntegrationManagementConfiguration‘ of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$4944dff8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-01-15 14:46:38.495INFO 91928 --- [main] trationDelegate$BeanPostProcessorChecker : Bean ‘integrationDisposableAutoCreatedBeans‘ of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-01-15 14:46:38.801INFO 91928 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer: Tomcat initialized with port(s): 9094 (http)
2019-01-15 14:46:38.890INFO 91928 --- [main] o.apache.catalina.core.StandardService: Starting service [Tomcat]
2019-01-15 14:46:38.891INFO 91928 --- [main] org.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.14]
2019-01-15 14:46:38.901INFO 91928 --- [main] o.a.catalina.core.AprLifecycleListener: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:Program FilesJavajdk1.8.0_181in; C:windowsSunJavain; C:windowssystem32; C:windows; C:Program Files (x86)Common FilesOracleJavajavapath; C:Program Files (x86)IntelIntel(R) Management Engine ComponentsiCLS; C:Program FilesIntelIntel(R) Management Engine ComponentsiCLS; C:windowssystem32; C:windows; C:windowsSystem32Wbem; C:windowsSystem32WindowsPowerShellv1.0; C:windowsSystem32OpenSSH; C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL; C:Program FilesIntelIntel(R) Management Engine ComponentsDAL; C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT; C:Program FilesIntelIntel(R) Management Engine ComponentsIPT; C:Program Files (x86)NVIDIA CorporationPhysXCommon; D:anaconda; D:anacondaScripts; D:anacondaLibraryin; C:Program FilesTortoiseSVNin; C:Program FilesGitcmd; C:Program Files odejs; C:UsersLvjingServiceAppDataLocalMicrosoftWindowsApps; C:Program FilesJavajdk1.8.0_181; C:Program FilesJavajre1.8.0_181; C:UsersLvjingServiceAppDataLocalGitHubDesktopin; C:UsersLvjingServiceAppDataRoaming pm; .]
2019-01-15 14:46:39.026INFO 91928 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/]: Initializing Spring embedded WebApplicationContext
2019-01-15 14:46:39.026INFO 91928 --- [main] o.s.web.context.ContextLoader: Root WebApplicationContext: initialization completed in 1963 ms
2019-01-15 14:46:39.757INFO 91928 --- [main] org.mongodb.driver.cluster: Cluster created with settings {hosts=[47.96.177.100:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout=‘30000 ms‘, maxWaitQueueSize=500}
2019-01-15 14:46:39.991INFO 91928 --- [6.177.100:27017] org.mongodb.driver.connection: Opened connection [connectionId{localValue:1, serverValue:131}] to 47.96.177.100:27017
2019-01-15 14:46:40.009WARN 91928 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘deviceStatusServiceImpl‘: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.lvjing.dao.DeviceStatusMapper‘ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
2019-01-15 14:46:40.013INFO 91928 --- [main] o.apache.catalina.core.StandardService: Stopping service [Tomcat]
2019-01-15 14:46:40.021WARN 91928 --- [main] o.a.c.loader.WebappClassLoaderBase: The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2019-01-15 14:46:40.026INFO 91928 --- [main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug‘ enabled.
2019-01-15 14:46:40.135 ERROR 91928 --- [main] o.s.b.d.LoggingFailureAnalysisReporter:
【Consider defining a bean of type ' com.lvjing.dao.DeviceStatusMapper' in your configuration.(】***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type ‘com.lvjing.dao.DeviceStatusMapper‘ that could not be found.

Action:
Consider defining a bean of type ‘com.lvjing.dao.DeviceStatusMapper‘ in your configuration.
 
 
 
原错误启动文件 Application.java 

package com.lvjing; /** * Created by huanghua on 2017/5/23. */import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication(exclude={DataSourceAutoConfiguration.class}) public class Application extends SpringBootServletInitializer {/**启动Spring boot服务**/ public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } }


 
修改@SpringBootApplication 注解
 
package com.lvjing; /** * Created by huanghua on 2017/5/23. */import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication(exclude={DataSourceAutoConfiguration.class},scanBasePackages = {"com.lvjing.dao.*"}) public class Application extends SpringBootServletInitializer {/**启动Spring boot服务**/ public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } }


成功!


































    推荐阅读