You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Modulith 2.0 includes support for propagating a named interface to include return types and parameter types (#1264).
This is a great feature for named interfaces, which saves a lot of unnecessary hassle.
I think this would also be a good feature for Application Modules themselves. For example, imagine I have a Service.java file in my module's top-level directory like this:
@Service
public class MyService {
public MyType findById(MyTypeId id) {
...
}
}
And imagine that both MyType and MyTypeId are defined within this module.
I think it would be helpful if both MyType and MyType were automatically exposed as part of the module's provided interface, even if their files were not located at the top-level.
The rationale for doing this propagation for Application Modules is the same as for Named Interfaces: if these types are essential components in the provided interface, it makes more sense to include them automatically, because the provided interface is unusable without them. Propagating the provided interface also allows you to keep a cleaner folder structure. Rather than having to move MyType and MyTypeId to the top-level for explicit inclusion, they can live in their natural location and we can discern the clear intention to include them in the application module's provided interface by the fact that they are referenced by something that is included in the public interface.
No doubt the question arises whether this propagation should be recursive i.e. if an additional type is included in a module's provided interface, should we extend the provided interface also to include parameter types and return types of the additional type's public methods? I think the answer is yes and if I've understood correctly, this is also how the propagation already works for Named Interfaces. In summary, I think Application Modules and Named Interfaces should work the same way with regard to propagation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Spring Modulith 2.0 includes support for propagating a named interface to include return types and parameter types (#1264).
This is a great feature for named interfaces, which saves a lot of unnecessary hassle.
I think this would also be a good feature for Application Modules themselves. For example, imagine I have a
Service.javafile in my module's top-level directory like this:And imagine that both
MyTypeandMyTypeIdare defined within this module.I think it would be helpful if both
MyTypeandMyTypewere automatically exposed as part of the module's provided interface, even if their files were not located at the top-level.The rationale for doing this propagation for Application Modules is the same as for Named Interfaces: if these types are essential components in the provided interface, it makes more sense to include them automatically, because the provided interface is unusable without them. Propagating the provided interface also allows you to keep a cleaner folder structure. Rather than having to move
MyTypeandMyTypeIdto the top-level for explicit inclusion, they can live in their natural location and we can discern the clear intention to include them in the application module's provided interface by the fact that they are referenced by something that is included in the public interface.No doubt the question arises whether this propagation should be recursive i.e. if an additional type is included in a module's provided interface, should we extend the provided interface also to include parameter types and return types of the additional type's public methods? I think the answer is yes and if I've understood correctly, this is also how the propagation already works for Named Interfaces. In summary, I think Application Modules and Named Interfaces should work the same way with regard to propagation.
Beta Was this translation helpful? Give feedback.
All reactions