1、异常如下:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2 2019-06-20 16:09:01.641 ERROR 15404 --- [on(3)-127.0.0.1] o.s.b.d.LoggingFailureAnalysisReporter : 3 4 *************************** 5 APPLICATION FAILED TO START 6 *************************** 7 8 Description: 9 10 A component required a bean of type 'com.boot.mapper.UserMapper' that could not be found. 11 12 13 Action: 14 15 Consider defining a bean of type 'com.boot.mapper.UserMapper' in your configuration. 16 17 20-Jun-2019 16:09:01.642 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method [manageApp] 18 java.lang.IllegalStateException: Error starting child 19 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:716) 20 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) 21 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) 22 at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1729) 23 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 24 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 25 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 26 at java.lang.reflect.Method.invoke(Method.java:498) 27 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) 28 at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 29 at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 30 at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457) 31 at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406) 32 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 33 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 34 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 35 at java.lang.reflect.Method.invoke(Method.java:498) 36 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) 37 at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 38 at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 39 at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) 40 at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) 41 at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) 42 at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) 43 at java.security.AccessController.doPrivileged(Native Method) 44 at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408) 45 at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 47 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 48 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 49 at java.lang.reflect.Method.invoke(Method.java:498) 50 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324) 51 at sun.rmi.transport.Transport$1.run(Transport.java:200) 52 at sun.rmi.transport.Transport$1.run(Transport.java:197) 53 at java.security.AccessController.doPrivileged(Native Method) 54 at sun.rmi.transport.Transport.serviceCall(Transport.java:196) 55 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) 56 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) 57 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) 58 at java.security.AccessController.doPrivileged(Native Method) 59 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) 60 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 61 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 62 at java.lang.Thread.run(Thread.java:745) 63 Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testBoot]] 64 at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441) 65 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) 66 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713) 67 ... 43 more 68 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testBootController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.boot.mapper.UserMapper' 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=)} 69 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:321) 70 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1225) 71 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:552) 72 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 73 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 74 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 75 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 76 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 77 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) 78 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) 79 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) 80 at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 81 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) 82 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) 83 at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) 84 at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151) 85 at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131) 86 at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86) 87 at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169) 88 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5125) <