首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是什么导致了此ArchUnit异常?

是什么导致了此ArchUnit异常?
EN

Stack Overflow用户
提问于 2021-10-20 08:02:33
回答 1查看 57关注 0票数 0

耽误您时间,实在对不起,

我一直在尝试使用Archunit,但我无法理解这个问题:

代码语言:javascript
复制
ComponentIntersectionException: Class 
com.yyy.xxx.common.configurations.properties.SomeClass may not be contained in more 
than one component, but is contained in [Common, Configuration]

我有一个相当标准的工厂图;虽然我不想分享它,但可能有一些ArchUnit的细微差别,我遗漏了。我的问题是,具体地说,在高层次上,我肯定做错了什么?

附加信息:测试:

代码语言:javascript
复制
    @Test
    void diagram_layersShouldBeRespected() throws IOException {
        classes().should(adhereToPlantUmlDiagram(PLANTUML_YAMl, consideringOnlyDependenciesInDiagram())).check(ALL_PROJECT_CLASSES);
    }

yaml:

代码语言:javascript
复制
@startuml
 
package "Config" {
  [Configuration] <<..configurations.properties..>>
//this is where SomeClass resides
}
 
package "Web Layer" {
  [Controller] <<..web.controllers..>>
  [Resources] <<..web.resources..>>
}
 
package "Business Layer" {
  [Services] <<..services..>>
  [Business Model] <<..models..>>
}
 
package "Adapter Layer" {
  [Databases] <<..dataaccess..>>
  [Integration] <<..adapters.azure..>> 
  [Storage] <<..adapters.azure.storage..>> 
}
 
package "Common Layer" {
  [Common] <<..common..>>
}
 
[Configuration] --> [Services]
[Configuration] --> [Storage]
[Configuration] --> [Common]
[Configuration] --> [Configuration]
[Common] --> [Configuration]
 
[Controller] --> [Resources]
[Controller] --> [Services]
[Controller] --> [Common]
[Resources] --> [Common]
 
[Services] --> [Databases]
[Services] --> [Integration]
[Services] --> [Storage]
[Services] --> [Common]
 
[Databases] --> [Common]
[Integration] --> [Common]
[Storage] --> [Common]
 
@enduml
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-21 08:37:45

因为@Thomas让我思考了我的问题的根源,我已经解决了它,如下所示:

问题是,作为我对组件(A)描述的一部分的包太模糊了,以至于对另一个组件(B)的描述也可以被认为是对该组件(A)的描述,所以我的一些类被认为属于>=2组件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69642374

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档