欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Error starting ApplicationContext. To display the conditions report re-run your application with ‘de

程序员文章站 2022-03-02 14:37:07
...

详细错误


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.]
[17:23:24.528] [ERROR] [main] [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] [

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

Description:

Field osProduct in com.netease.yanxuan.openapi.controller.ChannelController required a bean of type 'com.netease.yanxuan.openapi.pojo.entity.OsProduct' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.netease.yanxuan.openapi.pojo.entity.OsProduct' in your configuration.
]

Process finished with exit code 1

 

 

问题所在

注意:在controller实现层中注入实体类和Mapper接口的时候,OsProductMapper可以使用注解@Autowired注入,实体类OsProduct不可以注入

    @Autowired
    OsProductMapper osProductMapper;

    @Autowired
    OsProduct osProduct;

 

解决方法

实体类可以这样创建

         OsProduct osProduct=new OsProduct();
 

 

 

启动测试

"C:\Program Files\Java\jdk1.8.0_191\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\idea\IntelliJ IDEA 2020.1\lib\idea_rt.jar=58410:D:\idea\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_191\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\rt.jar;D:\ideaDM\05\zc-openapi-demo\target\classes;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter-web\2.4.0\spring-boot-starter-web-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter\2.4.0\spring-boot-starter-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot\2.4.0\spring-boot-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter-logging\2.4.0\spring-boot-starter-logging-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\java\tools\maven\RepositoryIdea\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\java\tools\maven\RepositoryIdea\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\java\tools\maven\RepositoryIdea\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\java\tools\maven\RepositoryIdea\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\java\tools\maven\RepositoryIdea\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\java\tools\maven\RepositoryIdea\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter-json\2.4.0\spring-boot-starter-json-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\jackson\core\jackson-databind\2.11.3\jackson-databind-2.11.3.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\jackson\core\jackson-annotations\2.11.3\jackson-annotations-2.11.3.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\jackson\core\jackson-core\2.11.3\jackson-core-2.11.3.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.3\jackson-datatype-jdk8-2.11.3.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.3\jackson-datatype-jsr310-2.11.3.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.3\jackson-module-parameter-names-2.11.3.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter-tomcat\2.4.0\spring-boot-starter-tomcat-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\apache\tomcat\embed\tomcat-embed-core\9.0.39\tomcat-embed-core-9.0.39.jar;D:\java\tools\maven\RepositoryIdea\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.39\tomcat-embed-websocket-9.0.39.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-web\5.3.1\spring-web-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-beans\5.3.1\spring-beans-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-webmvc\5.3.1\spring-webmvc-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-aop\5.3.1\spring-aop-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-context\5.3.1\spring-context-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-expression\5.3.1\spring-expression-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\net\bytebuddy\byte-buddy\1.10.18\byte-buddy-1.10.18.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-core\5.3.1\spring-core-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-jcl\5.3.1\spring-jcl-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter-validation\2.4.0\spring-boot-starter-validation-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\java\tools\maven\RepositoryIdea\org\hibernate\validator\hibernate-validator\6.1.6.Final\hibernate-validator-6.1.6.Final.jar;D:\java\tools\maven\RepositoryIdea\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;D:\java\tools\maven\RepositoryIdea\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;D:\java\tools\maven\RepositoryIdea\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\java\tools\maven\RepositoryIdea\com\alibaba\fastjson\1.2.51\fastjson-1.2.51.jar;D:\java\tools\maven\RepositoryIdea\org\apache\httpcomponents\httpclient\4.3.1\httpclient-4.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\apache\httpcomponents\httpcore\4.4.13\httpcore-4.4.13.jar;D:\java\tools\maven\RepositoryIdea\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;D:\java\tools\maven\RepositoryIdea\mysql\mysql-connector-java\8.0.22\mysql-connector-java-8.0.22.jar;D:\java\tools\maven\RepositoryIdea\org\projectlombok\lombok\1.18.16\lombok-1.18.16.jar;D:\java\tools\maven\RepositoryIdea\com\baomidou\mybatis-plus-boot-starter\3.0.5\mybatis-plus-boot-starter-3.0.5.jar;D:\java\tools\maven\RepositoryIdea\com\baomidou\mybatis-plus\3.0.5\mybatis-plus-3.0.5.jar;D:\java\tools\maven\RepositoryIdea\com\baomidou\mybatis-plus-extension\3.0.5\mybatis-plus-extension-3.0.5.jar;D:\java\tools\maven\RepositoryIdea\com\baomidou\mybatis-plus-core\3.0.5\mybatis-plus-core-3.0.5.jar;D:\java\tools\maven\RepositoryIdea\com\baomidou\mybatis-plus-annotation\3.0.5\mybatis-plus-annotation-3.0.5.jar;D:\java\tools\maven\RepositoryIdea\com\github\jsqlparser\jsqlparser\1.2\jsqlparser-1.2.jar;D:\java\tools\maven\RepositoryIdea\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;D:\java\tools\maven\RepositoryIdea\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;D:\java\tools\maven\RepositoryIdea\com\baomidou\mybatis-plus-generator\3.0.5\mybatis-plus-generator-3.0.5.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-autoconfigure\2.4.0\spring-boot-autoconfigure-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-starter-jdbc\2.4.0\spring-boot-starter-jdbc-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-jdbc\5.3.1\spring-jdbc-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\spring-tx\5.3.1\spring-tx-5.3.1.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\boot\spring-boot-configuration-processor\2.4.0\spring-boot-configuration-processor-2.4.0.jar;D:\java\tools\maven\RepositoryIdea\org\apache\velocity\velocity-engine-core\2.2\velocity-engine-core-2.2.jar;D:\java\tools\maven\RepositoryIdea\org\apache\commons\commons-lang3\3.11\commons-lang3-3.11.jar;D:\java\tools\maven\RepositoryIdea\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\java\tools\maven\RepositoryIdea\com\spring4all\spring-boot-starter-swagger\1.5.1.RELEASE\spring-boot-starter-swagger-1.5.1.RELEASE.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-swagger-ui\2.7.0\springfox-swagger-ui-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-spring-web\2.7.0\springfox-spring-web-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\org\reflections\reflections\0.9.11\reflections-0.9.11.jar;D:\java\tools\maven\RepositoryIdea\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-swagger2\2.7.0\springfox-swagger2-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\io\swagger\swagger-annotations\1.5.13\swagger-annotations-1.5.13.jar;D:\java\tools\maven\RepositoryIdea\io\swagger\swagger-models\1.5.13\swagger-models-1.5.13.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-spi\2.7.0\springfox-spi-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-core\2.7.0\springfox-core-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-schema\2.7.0\springfox-schema-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-swagger-common\2.7.0\springfox-swagger-common-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\java\tools\maven\RepositoryIdea\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\java\tools\maven\RepositoryIdea\org\mapstruct\mapstruct\1.1.0.Final\mapstruct-1.1.0.Final.jar;D:\java\tools\maven\RepositoryIdea\io\springfox\springfox-bean-validators\2.7.0\springfox-bean-validators-2.7.0.jar;D:\java\tools\maven\RepositoryIdea\com\google\guava\guava\29.0-jre\guava-29.0-jre.jar;D:\java\tools\maven\RepositoryIdea\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\java\tools\maven\RepositoryIdea\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\java\tools\maven\RepositoryIdea\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\java\tools\maven\RepositoryIdea\org\checkerframework\checker-qual\2.11.1\checker-qual-2.11.1.jar;D:\java\tools\maven\RepositoryIdea\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;D:\java\tools\maven\RepositoryIdea\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;D:\java\tools\maven\RepositoryIdea\cn\hutool\hutool-all\5.5.1\hutool-all-5.5.1.jar;D:\java\tools\maven\RepositoryIdea\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\java\tools\maven\RepositoryIdea\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar" com.ZcOpenapiDemoApplication
17:29:16,022 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
17:29:16,022 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
17:29:16,022 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/D:/ideaDM/05/zc-openapi-demo/target/classes/logback.xml]
17:29:16,073 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
17:29:16,075 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
17:29:16,078 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
17:29:16,091 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
17:29:16,091 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
17:29:16,092 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.netease.yanxuan.openapi.pojo.mapper] to DEBUG
17:29:16,092 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
17:29:16,093 |-INFO in [email protected] - Registering current configuration as safe fallback point
17:29:16,312 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
17:29:16,312 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
17:29:16,312 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
17:29:16,312 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
17:29:16,313 |-INFO in [email protected] - Propagating INFO level on Logger[ROOT] onto the JUL framework
17:29:16,313 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
17:29:16,313 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.netease.yanxuan.openapi.pojo.mapper] to DEBUG
17:29:16,313 |-INFO in [email protected] - Propagating DEBUG level on Logger[com.netease.yanxuan.openapi.pojo.mapper] onto the JUL framework
17:29:16,313 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
17:29:16,313 |-INFO in org.s[email protected]7a675056 - Registering current configuration as safe fallback point

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.0)

[17:29:16.353] [INFO ] [background-preinit] [org.hibernate.validator.internal.util.Version] [HV000001: Hibernate Validator 6.1.6.Final]
[17:29:16.356] [INFO ] [main] [com.ZcOpenapiDemoApplication] [Starting ZcOpenapiDemoApplication using Java 1.8.0_191 on DESKTOP-3M08IL4 with PID 10372 (D:\ideaDM\05\zc-openapi-demo\target\classes started by Admin in D:\ideaDM\05\zc-openapi-demo)]
[17:29:16.357] [INFO ] [main] [com.ZcOpenapiDemoApplication] [The following profiles are active: config]
[17:29:17.829] [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] [Tomcat initialized with port(s): 8888 (http)]
[17:29:17.833] [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] [Initializing ProtocolHandler ["http-nio-8888"]]
[17:29:17.834] [INFO ] [main] [org.apache.catalina.core.StandardService] [Starting service [Tomcat]]
[17:29:17.834] [INFO ] [main] [org.apache.catalina.core.StandardEngine] [Starting Servlet engine: [Apache Tomcat/9.0.39]]
[17:29:17.835] [INFO ] [main] [org.apache.catalina.core.AprLifecycleListener] [Loaded Apache Tomcat Native library [1.2.24] using APR version [1.7.0].]
[17:29:17.835] [INFO ] [main] [org.apache.catalina.core.AprLifecycleListener] [APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].]
[17:29:17.835] [INFO ] [main] [org.apache.catalina.core.AprLifecycleListener] [APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]]
[17:29:17.837] [INFO ] [main] [org.apache.catalina.core.AprLifecycleListener] [OpenSSL successfully initialized [OpenSSL 1.1.1g  21 Apr 2020]]
[17:29:17.890] [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]] [Initializing Spring embedded WebApplicationContext]
[17:29:17.890] [INFO ] [main] [org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext] [Root WebApplicationContext: initialization completed in 1508 ms]
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.0.5 
[17:29:18.333] [INFO ] [main] [com.zaxxer.hikari.HikariDataSource] [HikariPool-1 - Starting...]
[17:29:18.516] [INFO ] [main] [com.zaxxer.hikari.HikariDataSource] [HikariPool-1 - Start completed.]
[17:29:19.204] [INFO ] [main] [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping] [Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]]
[17:29:19.260] [INFO ] [main] [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] [Initializing ExecutorService 'applicationTaskExecutor']
[17:29:19.379] [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] [Starting ProtocolHandler ["http-nio-8888"]]
[17:29:19.390] [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] [Tomcat started on port(s): 8888 (http) with context path '']
[17:29:19.391] [INFO ] [main] [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper] [Context refreshed]
[17:29:19.399] [INFO ] [main] [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper] [Found 1 custom documentation plugin(s)]
[17:29:19.420] [INFO ] [main] [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner] [Scanning for api listing references]
[17:29:19.631] [INFO ] [main] [com.ZcOpenapiDemoApplication] [Started ZcOpenapiDemoApplication in 3.481 seconds (JVM running for 4.125)]

 

相关标签: 错误BUG