java - UnsatisfiedDependencyException bean 名称错误 通过字段表达的依赖关系不满足

标签 java maven spring-boot

我是使用微服务架构的新手,想要从另一个使用 camunda(只读业务流程工具(库))的模块访问 bean。错误未满足的依赖关系来自 camunda 接口(interface),但我在当前模块中不需要来自 camunda 的任何 bean,因此我尝试使用以下代码排除它:

@Configuration
@ComponentScan(basePackages = {"com.example"}, excludeFilters={
 @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, value=SpringProcessEngineServicesConfiguration.class)}) 

当前模块不会开始提供以下堆栈跟踪:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration': Unsatisfied dependency expressed through field 'processEngine': Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.exception.NotValidException: Filter name must not be null or empty: name is null; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.exception.NotValidException: Filter name must not be null or empty: name is null

最佳答案

我的解决方案很简单,尽管花了很长时间才解决。我设法用下面的代码解决了这个问题:

<exclusions>
    <exclusion>
        <groupId>org.camunda.blablabla</groupId>
        <artifactId>*</artifactId>
    </exclusion>
</exclusions>

所需要做的就是排除模块依赖项部分中的所有 camunda 依赖项。傻我啊!

关于java - UnsatisfiedDependencyException bean 名称错误 通过字段表达的依赖关系不满足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45600275/

相关文章:

java - SQL 如何仅返回一些列,例如前 10 列,而不在 SQL 查询中指定它们

java - 如何将 Java 项目转换为 Maven 项目

spring-boot - Elasticsearch Resthighlevelclient 将数据索引到 AWS Elasticsearch 服务时出现 Noclassfound 错误

java - 从较大目录(工作空间)中的文件获取特定单词

java - 如何避免 "Root WebApplicationContext: initialization started"加载两次?

javascript - 如何在JSP中使用REST Api?

maven - 使用 maven cargo 插件将网络应用程序部署到外部 glassfish4 实例

maven - Jenkins pipeline、bitbucket hook 和 maven 发布插件无限循环

spring - Thymeleaf 缓存设置为 false 不起作用

java - 集成测试期间托管网站