Skip to content

Commit

Permalink
Integrate Spring Modulith in application-server (#59)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix T.J. Dietrich <[email protected]>
  • Loading branch information
GODrums and FelixTJDietrich authored Aug 16, 2024
1 parent ee897e0 commit d46377e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
27 changes: 24 additions & 3 deletions server/application-server/pom.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.2</version>
<relativePath /> <!-- lookup parent from repository -->
<relativePath />
<!-- lookup parent from repository -->
</parent>
<groupId>de.tum.in.www1</groupId>
<artifactId>hephaestus</artifactId>
Expand Down Expand Up @@ -111,8 +111,29 @@
<artifactId>therapi-runtime-javadoc</artifactId>
<version>0.15.0</version>
</dependency>
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-starter-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-bom</artifactId>
<version>1.2.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.modulith.Modulithic;

@SpringBootApplication
@Modulithic(systemName = "Hephaestus")
public class Application {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class HephaestusApplicationTests {

@Test
void contextLoads() {
// ContextLoads
assert (true);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package de.tum.in.www1.hephaestus;

import org.junit.jupiter.api.Test;
import org.springframework.modulith.core.ApplicationModules;
import org.springframework.modulith.docs.Documenter;
import org.springframework.modulith.docs.Documenter.DiagramOptions;
import org.springframework.modulith.docs.Documenter.DiagramOptions.DiagramStyle;

public class HephaestusModulithTests {

ApplicationModules modules = ApplicationModules.of(Application.class);

@Test
void shouldBeCompliant() {
modules.forEach(System.out::println);
modules.verify();
}

@Test
void writeDocumentationSnippets() {
DiagramOptions options = DiagramOptions.defaults().withStyle(DiagramStyle.UML);
new Documenter(modules)
.writeModuleCanvases()
.writeModulesAsPlantUml(options)
.writeIndividualModulesAsPlantUml(options);
}

}

0 comments on commit d46377e

Please sign in to comment.