From b3a3c455353ba4a8265c44f8e4d535a4e47dd4b8 Mon Sep 17 00:00:00 2001 From: Roland Weisleder Date: Wed, 29 May 2024 16:28:28 +0200 Subject: [PATCH] Enhance user guide --- src/main/docs/userguide.adoc | 35 +++++++++++++++++++ .../spring/framework/SpringAsyncRules.java | 6 ++++ 2 files changed, 41 insertions(+) diff --git a/src/main/docs/userguide.adoc b/src/main/docs/userguide.adoc index 514ed45..db9ae34 100644 --- a/src/main/docs/userguide.adoc +++ b/src/main/docs/userguide.adoc @@ -1,7 +1,12 @@ +:toc: +:toc-placement!: + = ArchUnit Spring Integration The ArchUnit Spring Integration provides predefined https://github.com/TNG/ArchUnit[ArchUnit] rules for https://spring.io/projects[Spring] applications. +toc::[] + == Overview The <> help you to avoid typical problems when developing Spring applications that would otherwise lead to unexpected behavior. @@ -112,6 +117,36 @@ Such internal calls bypass Spring's proxy mechanism, causing the intended cachin This rule should only be used if caching is used in proxy mode (which is the default mode), see the `@EnableCaching` annotation. +==== SpringComponentPredicates + +The class `SpringComponentPredicates` contains predefined predicates to match the different Spring stereotypes like `@Controller`, `@Service` and `@Repository`. + +==== SpringComponentRules + +===== Rule DependenciesOfControllers + +The rule `SpringComponentRules.DependenciesOfControllers` ensures that all controller classes only depend on service classes or repository classes. +They should not depend on other controller classes or configuration classes. + +===== Rule DependenciesOfServices + +The rule `SpringComponentRules.DependenciesOfServices` ensures that all service classes only depend on other service classes or repository classes. +They should not depend on controller classes or configuration classes. + +===== Rule DependenciesOfRepositories + +The rule `SpringComponentRules.DependenciesOfRepositories` ensures that all repository classes only depend on other repository classes. +They should not depend on controller classes, service classes, or configuration classes. + +=== Spring Boot + +==== SpringBootRules + +===== Rule AllTypesInApplicationPackage + +The rule `SpringBootRules.AllTypesInApplicationPackage` checks that all classes are located in the same package or a sub-package of the application class. +The application class is the one annotated with `@SpringBootApplication` or `@SpringBootConfiguration`. + == Compatibility and Support === Open Source Edition diff --git a/src/main/java/de/rweisleder/archunit/spring/framework/SpringAsyncRules.java b/src/main/java/de/rweisleder/archunit/spring/framework/SpringAsyncRules.java index bfecad8..b91645e 100644 --- a/src/main/java/de/rweisleder/archunit/spring/framework/SpringAsyncRules.java +++ b/src/main/java/de/rweisleder/archunit/spring/framework/SpringAsyncRules.java @@ -36,6 +36,12 @@ import static de.rweisleder.archunit.spring.framework.SpringProxyRules.beProxyable; import static de.rweisleder.archunit.spring.framework.SpringProxyRules.notBeCalledFromWithinTheSameClass; +/** + * Collection of {@link ArchRule rules} that can be used to check the usage + * of Spring's support for asynchronous method execution. + * + * @author Roland Weisleder + */ public final class SpringAsyncRules { private SpringAsyncRules() {