Repository navigation
Is it possible to exclude types from the default unnamed api of an Application Module? #1557
Replies: 1 comment
|
not without either moving the type or assigning it to a named interface. Your understanding is right. In the source, the unnamed interface is built from all public types in the module's base package, minus the ones annotated with The good news is that your example doesn't actually need I checked this with Spring Modulith 2.1.2 and If you really want to keep the class in the base package, the only other lever is a type-level named interface: @NamedInterface("persistence")
public interface OrderRepository { … }That removes it from the unnamed interface, but it does not hide it. Modules that don't declare A third option is to turn it around: keep Docs: Advanced application modules and Named interfaces. If that answers it, I'd appreciate it if you marked it as the answer. |
Uh oh!
There was an error while loading. Please reload this page.
In my understanding all public types inside an
ApplicationModuleare part of its public api ("unnamed" named interface). When adding types to another NamedInterfaces, those types are automatically excluded from the unnamed interface.Is there another way to exclude public java types from an ApplicationModule? Let's say, my module looks like this:
Assuming
OrderSupervisorneeds to accessOrderRepository,OrderRepositoryhas to bepublic, but that makes it part of theorderApplicationModule. Is it possible to exclude it other than moving it to a different (internal) subpackage?Thanks!
All reactions