简体   繁体   English

Jenkins 构建 UnsatisfiedDependencyException:创建带有名称的 bean 时出错

[英]Jenkin build UnsatisfiedDependencyException: Error creating bean with name

I'm working on a project which is based on Spring Boot ( 2.3.8 ).我正在开发一个基于 Spring Boot ( 2.3.8 ) 的项目。 It's working fine when i build in my local environment.当我在本地环境中构建时,它工作正常。 But I'm getting UnsatisfiedDependencyException: Error creating bean with name when i build the same app through jenkins.但是当我通过 jenkins 构建相同的应用程序时,我得到了UnsatisfiedDependencyException: Error creating bean with name

Local Env:本地环境:

  • java version "1.8.0_281" java 版本“1.8.0_281”
  • maven 3.6.3 maven 3.6.3
  • Windows 10 Windows 10

Server Env:服务器环境:

  • openjdk version "1.8.0_191" openjdk 版本“1.8.0_191”
  • maven 3.6.0 maven 3.6.0
  • Ubutnu 16乌布努 16

The UnsatisfiedDependencyException means that you are missing injecting a Dependency in one of your Components. UnsatisfiedDependencyException 意味着您缺少在其中一个组件中注入依赖项。 When using @Autowired or Constructor based injection you need to initialize all the beans that you wish to Autowire in a Service or a Component.使用 @Autowired 或基于构造函数的注入时,您需要初始化所有希望在服务或组件中自动装配的 bean。

In your case since its working on you local means that Jenkins is having a different profile running than that on your local.在您的情况下,因为它在您本地工作意味着 Jenkins 运行的配置文件与您本地的配置文件不同。 Check what profile are you starting the App on local.检查您在本地启动应用程序的配置文件。 If its tests that are failing in Jenkins then check running on local with the tests profile in spring.如果其测试在 Jenkins 中失败,则使用 spring 中的测试配置文件检查在本地运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UnsatisfiedDependencyException - 创建具有名称的 bean 时出错 - UnsatisfiedDependencyException - Error creating bean with name UnsatisfiedDependencyException:使用名称创建 bean 时出错 - UnsatisfiedDependencyException: Error creating bean with name 错误:UnsatisfiedDependencyException:创建名为“entityManagerFactory”的 bean 时出错 - Error: UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' REST API 中创建bean名时出现UnsatisfiedDependencyException错误 - UnsatisfiedDependencyException error in creating bean name in REST API UnsatisfiedDependencyException:创建名称为“registrationController”的 bean 时出错 - UnsatisfiedDependencyException: Error creating bean with name 'registrationController' UnsatisfiedDependencyException:创建名为“entityManagerFactory”的 bean 时出错 - UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' UnsatisfiedDependencyException:创建名称为“ trafficMapper”的bean时出错 - UnsatisfiedDependencyException: Error creating bean with name 'trafficMapper' UnsatisfiedDependencyException:创建名称为“requestMappingHandlerAdapter”的 bean 时出错 - UnsatisfiedDependencyException: Error creating bean with name 'requestMappingHandlerAdapter' UnsatisfiedDependencyException:创建名为“empController”的bean时出错 - UnsatisfiedDependencyException: Error creating bean with name “empController” UnsatisfiedDependencyException:创建名称为'accountController'的bean时出错 - UnsatisfiedDependencyException: Error creating bean with name 'accountController'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM