Commit Graph

68 Commits

Author SHA1 Message Date
Oliver Drotbohm
51c5f0bf42 GH-601 - Support for wildcard references to named interfaces in explicitly defined allowed application module dependencies.
When defining allowed application module dependencies to named interfaces, the asterisk can now be used to allow referencing all named interfaces declared by the target module.
2024-05-16 16:03:14 +02:00
Oliver Drotbohm
e9203ca159 GH-594 - Polishing. 2024-05-16 13:27:45 +02:00
Oliver Drotbohm
3855479c7c GH-595 - Invalid dependency into named interface now gets reported properly. 2024-05-16 12:34:28 +02:00
Oliver Drotbohm
2bf9f797ec GH-594 - Deduplicate violations with the same message.
Moving away from exceptions as carriers for violations.
2024-05-16 12:20:44 +02:00
Oliver Drotbohm
ce2f608e60 GH-536 - Add missing package-info.java files. 2024-03-22 08:48:51 +01:00
Oliver Drotbohm
e41d7ec083 GH-520 - Early reject invalid ApplicationModules bootstraps.
We now immediately reject the ApplicationModules bootstrap in case the initial scanning of the root packages yield no classes at all.
2024-03-05 19:34:47 +01:00
Oliver Drotbohm
c45a0fc9b7 GH-522 - Polishing. 2024-03-05 11:52:04 +01:00
Oliver Drotbohm
5f7e6a2479 GH-522 - Support for package info types.
Introduce @PackageInfo annotation to allow marking a types as alternative to Java's native package-info.java so that annotation lookups on a JavaPackage will also find annotations placed on that type. Useful to declare package scoped metadata like @ApplicationModule and @NamedInterface for languages that do not support packages well enough (read: Kotlin).
2024-03-05 09:55:34 +01:00
Oliver Drotbohm
f3c111f769 GH-284 - Support for open application modules.
Application modules can now be declared as open, which causes internal components being exposed for access by other modules.
2024-02-29 12:58:49 +01:00
Lukas Dohmen
d325c83736 GH-508 - Fix parameter name to match Javadoc. 2024-02-23 11:44:52 +01:00
josroseboom
e1e9b237c8 GH-490 - Use Types constant to decide if a type is an entity. 2024-02-14 16:36:15 +01:00
Oliver Drotbohm
c32227bdfb GH-463 - Update copyright headers. 2024-01-17 19:45:40 +01:00
Oliver Drotbohm
48aa0b246a GH-406 - Improve detection of AOT types generated by Spring.
We now guard the annotation predicate for @Generated behind a classpath check to avoid a NoClassDefFoundError on previous versions of Spring Framework.
2024-01-17 16:30:40 +01:00
Oliver Drotbohm
b9f3fc2263 GH-418 - Include JSR 303 ConstraintValidator implementations in bootstrap dependency analysis.
Spring Boot configures Hibernate Validator in a way that the latter looks up the components it needs to instantiate via the Spring container. That in turn then creates prototype instances of the types requested. This means, implementations of e.g. ConstraintValidator do not need to be explicitly marked as Spring beans, but could still declare dependencies to other Spring beans. If such a dependency crosses a module boundary, we currently fail to detect that implicitly established module dependency.

This is now fixed by considering ConstraintValidator implementations Spring beans implicitly in out bootstrap dependency analysis.
2023-12-21 18:09:29 +01:00
Oliver Drotbohm
c1f5630a72 GH-406 - Improving the detection of Spring AOT classes.
We now inspect the classes for the newly introduced Spring AOT @Generated annotation instead of a name containing a double underscore.
2023-12-08 22:15:29 +01:00
Oliver Drotbohm
e7b531e061 GH-406 - Ignore Spring AOT generated types in architecture model.
We now explicitly exclude classes generated by Spring AOT in the architectural model. For technical reasons, they might introduce dependencies to application components considered module internals otherwise. Also, proxies generated do not need to be considered either.
2023-12-06 14:17:43 +01:00
Oliver Drotbohm
889c849492 GH-348 - Avoid eager reference to runtime artifact from core starter.
Removed the inclusion of the spring-modulith-runtime artifact from the …-starter-core one to avoid issues in native images in a Spring Modulith default setup. As the artifact is still needed to support ApplicationModuleInitializer implementations, we now explicitly check for the presence of those and verify the artifact is actually available and hint the user at explicitly adding it if missing.
2023-10-27 09:41:26 +02:00
Oliver Drotbohm
86f745e5b7 GH-317 - Fix Javadoc. 2023-10-16 08:28:16 +02:00
Oliver Drotbohm
9148a57b02 GH-317 - Detect violations from types located in root packages.
We now create artificial root application modules for all root packages to detect violations (for example, types located in root packages referring to module-internal types).
2023-10-16 07:57:16 +02:00
Oliver Drotbohm
4a857dcddf GH-323 - Move off of Google's Suppliers.memoize(…). 2023-10-15 19:23:08 +02:00
Oliver Drotbohm
cb6d71ba60 GH-319 - Fix ApplicationModule by package name lookup.
Prior to this commit, the lookup for an ApplicationModule would find modules solely depending on the reference string starting with the base package. That means that a module with base package com.acme.foo, a request for com.acme.foobar would've resulted in a positive match, which of course is wrong.

We now match against either the module's base package or against the reference starting with the base package followed by a dot.
2023-10-15 17:29:27 +02:00
Oliver Drotbohm
9568f29613 GH-267 - Explicitly declared empty allowed dependencies now forbids any dependency.
The default for @ApplicationModule(allowedDependencies) is now a single element list with a dedicated token we recognize as "all dependencies allowed". This allows users to declare an empty array explicitly to disallow any outgoing dependencies for an application module. Previously, such a declaration would have allowed any dependency.
2023-08-15 19:52:02 +02:00
Oliver Drotbohm
43418b5fe0 GH-246 - Upgrade to ArchUnit 1.1.0.
Related tickets: GH-221.
2023-08-09 21:21:18 +02:00
Oliver Drotbohm
9fe114387a GH-221 - Temporarily shadow ArchUnit's Location type.
It includes the fix submitted for TNG/ArchUnit#1131. To be removed once we can upgrade to a released version of the fix.
2023-07-20 16:26:32 +02:00
Oliver Drotbohm
fb839cb8a5 GH-230 - Caches in ApplicationModules and ArchitecturallyEvidentType are now ConcurrentHashMaps. 2023-07-05 13:56:01 +02:00
Oliver Drotbohm
547b6091f0 GH-229 - ApplicationModuleExporter can now write output to a file. 2023-07-05 13:54:45 +02:00
Oliver Drotbohm
9bfcf71a5d GH-227 - ApplicationModulesExporter now writes JSON containing named interfaces. 2023-06-30 17:29:56 +02:00
Oliver Drotbohm
4656f82089 GH-187 - Do not include non-exposed Spring beans that implement interfaces in Application Module Canvas by default.
We now properly check whether one of a Spring bean's implemented interfaces is exposed by the module before including it in the default rendering of the Application Module Canvas.
2023-04-30 22:35:14 +02:00
Oliver Drotbohm
394e87337b GH-187 - Unit tests for Spring Data repository detection.
Both imperative and reactive flavours.
2023-04-28 20:22:27 +02:00
Oliver Drotbohm
fbd2c2e66f GH-182 - Use dedicated SliceAssignment to verify modularity.
The previous modularity verification arrangement assumed the default module detection strategy to be used. To properly support alternative implementations during the verification we now use a dedicated SliceAssignment implementation that assigns types to slices identified by the module they are located in.
2023-04-23 23:24:02 +02:00
Oliver Drotbohm
d9f298c96a GH-183 - Improvements in named interface declarations.
Type based named interfaces on types declared in a module's API package still caused the type to be included in the unnamed interface. This is now fixed by explicitly removing named interface types from the unnamed interface.

We now also detect API package types assigned to a named interface without an explicit name as the package name defaulting doesn't work in this case.

Furthermore, named interfaces are now sorted alphabetically to make the unnamed one always appear first.
2023-04-23 23:21:00 +02:00
Oliver Drotbohm
daee88a227 GH-177 - Javadoc polishing. 2023-03-31 13:44:06 +02:00
Oliver Drotbohm
2454ecbc4b GH-177 - Named interfaces names now default to the local package name.
Both package- and type-level declarations now use the local package name as the named interface's name. This allows to, at the same time, easily declared named interfaces based on packages but also a nice decoupling of the interface definition and the package layout as individual types can be assigned to such interfaces no matter where they are actually declared.
2023-03-31 13:34:21 +02:00
Oliver Drotbohm
c58497979d GH-170 - Improve log output for ApplicationModule.
We now consider whether a type is exposed by a module to determine whether it is reported as public (+) or contained (o) type.
2023-03-23 13:00:56 +01:00
Oliver Drotbohm
d0ffcddd29 GH-157 - Improve aggregate lookup.
We now directly collect all aggregate types instead of looking up entities first.
2023-03-04 00:21:22 +01:00
Oliver Drotbohm
71f928f5b0 GH-130 - Polishing.
Organized imports.
2023-02-03 11:09:07 +01:00
Oliver Drotbohm
c4fe271689 GH-130 - Fall back to annotated class' name as system name. 2023-02-03 10:52:14 +01:00
Oliver Drotbohm
868fddca50 GH-119 - Added package-info.java for util package. 2023-01-19 15:17:29 +01:00
Oliver Drotbohm
090ddc6fba GH-119 - Improve rendering of application modules structure as JSON.
Introduced ApplicationModulesExporter to render an ApplicationModules instances as JSON directly. To avoid a dependency to a JSON library and as we only have to be able to render rather simple arrangements, we just build up the JSON string ourselves.

ApplicationModulesEndpoint now caches the structure calculated once to avoid repeated work.
2023-01-18 18:39:09 +01:00
Oliver Drotbohm
5c34886907 GH-114 - Rename ….modulith.model to ….modulith.core. 2023-01-12 16:34:07 +01:00
Oliver Drotbohm
0d009f06c9 GH-111 - Package and publish Javadoc.
A lot of Javadoc polish. Not done yet.
2023-01-12 16:20:20 +01:00
Oliver Drotbohm
9ce6bf23ae GH-14 - Remove Lombok from production sources.
Polished a lot of Javadoc.
2023-01-12 01:05:35 +01:00
Oliver Drotbohm
262efb5828 GH-106 - Avoid intercepting Object and proxy-related methods for module interaction tracing.
We now skip Object methods and ones declared on Spring's Advised or TargetClassAware types when intercepting invocations to trigger a module entry.
2023-01-05 20:00:54 +01:00
Oliver Drotbohm
d8463bb84b GH-102 - Avoid topological sorting to fail on cyclic module graphs.
We now fall back to the default non-topological ordering in case the application module graph contains cycles.
2023-01-05 11:21:14 +01:00
Oliver Drotbohm
30203ecca8 GH-104 - Polish log output for test execution.
Also added ApplicationModules.toString().
2023-01-05 10:21:42 +01:00
Oliver Drotbohm
a7e033172b GH-102 - ApplicationModules now allows traversing modules in topological order.
We now optionally integrate with the JGraphT library to calculate the topological order of modules based on their dependency structure. That order is then exposed in ApplicationModules' iteration and via ….getComparator().

Renamed FormattableJavaClass to FormattableType and allow it to be created from a plain Class as well.
2023-01-05 10:21:36 +01:00
Oliver Drotbohm
4e13fbf7f8 GH-99 - Extend license headers to 2023. 2023-01-02 18:12:29 +01:00
Oliver Drotbohm
c1fc3032b7 GH-87 - Expose module structure as actuator endpoint.
Introduce Spring Modulith Actuator module to expose the application module structure as Spring Boot actuator. This required a Spring Modulith Runtime module to be extracted from the Spring Modulith Observability one. The former now contains the auto-configured ApplicationRuntime and ApplicationModulesRuntime bean instances to be able to bootstrap a ApplicationModules asynchronously on application startup. The actuator module then contains a Spring Boot @Endpoint implementation consuming the ApplicationModules to render JSON describing the application module structure.
2022-12-23 10:56:47 +01:00
Oliver Drotbohm
065db76547 GH-74 - Polishing. 2022-11-18 00:13:30 +01:00
Oliver Drotbohm
22993f43d9 GH-74 - Bean references in Application Module Canvas now get de-duplicated. 2022-11-18 00:13:18 +01:00