Skip to content

Conversation

@poutsma
Copy link
Contributor

@poutsma poutsma commented Dec 8, 2025

This PR introduces two additional ArchUnit tests:

  • com.embabel.agent.core should not depend on com.embabel.agent.api
  • com.embabel.agent.api should not depend on com.embabel.agent.spi

This commit introduces two additional ArchUnit tests:

- com.embabel.agent.core should not depend on com.embabel.agent.api
- com.embabel.agent.api should not depend on com.embabel.agent.spi

Signed-off-by: Arjen Poutsma <[email protected]>
@poutsma poutsma requested a review from igordayen December 8, 2025 14:38

@ArchTest
val apiShouldNotDependOnSpi =
noClasses().that().resideInAPackage("..api..")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arjen, could you please confirm as per design "api" should not depend on "spi" and what is your envision of relationships.
Perhaps good to have published guidance on relationships (wiki?)

From Web:
The application developer (client) uses classes from the API package.
Internally, the API's implementation code uses a service locator to find available implementations of the SPI interfaces at runtime.
The actual concrete classes that implement the SPI are typically in a separate, implementation-specific package, which the main library dynamically loads.
Therefore, the architectural guideline is to keep the API and SPI packages separate, with the API implementation code using the SPI internally, but the API's interface definitions remaining independent of the specific SPI implementation details.

Thank you.

@igordayen
Copy link
Contributor

igordayen commented Dec 9, 2025

or this just an example of circular dependencies, and can also worded as "no SPI dependencies on API"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants