-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
spring-modulith-cli/.spring/commands/modulith/add-listener/ApplicationModuleListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package {{root-package}}.{{module}}; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
class {{capitalize name}}EventListener { | ||
|
||
@ApplicationModuleListener | ||
void on({{eventType}} event) { | ||
|
||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
spring-modulith-cli/.spring/commands/modulith/add-listener/command.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
command: | ||
description: Add an application module listener | ||
options: | ||
|
||
- name: module | ||
description: The name of the module to create the listener in. | ||
required: true | ||
|
||
- name: name | ||
description: The name of the listener type. | ||
required: true | ||
|
||
- name: eventType | ||
description: The event type to listen to. | ||
required: true |
8 changes: 8 additions & 0 deletions
8
spring-modulith-cli/.spring/commands/modulith/add-module/ApplicationModuleComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package {{root-package}}.{{name}}; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
class {{capitalize name}}Component { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...-modulith-cli/.spring/commands/modulith/add-module/ApplicationModuleIntegrationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package {{root-package}}.{{name}}; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.modulith.test.ApplicationModuleTest; | ||
|
||
@ApplicationModuleTest | ||
class {{capitalizeFirst name}}ModuleIntegrationTests { | ||
|
||
@Test | ||
void bootstrapsModule() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
spring-modulith-cli/.spring/commands/modulith/add-module/add-module.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
actions: | ||
- generate: | ||
to: src/main/java/{{root-package-dir}}/{{name}}/{{capitalize name}}Component.java | ||
from: ApplicationModuleComponent.java | ||
- generate: | ||
to: src/test/java/{{root-package-dir}}/{{name}}/{{capitalize name}}ModuleIntegrationTests.java | ||
from: ApplicationModuleIntegrationTests.java |
6 changes: 6 additions & 0 deletions
6
spring-modulith-cli/.spring/commands/modulith/add-module/command.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
command: | ||
description: Add an application module | ||
options: | ||
- name: name | ||
description: The name of the application module. | ||
required: true |
26 changes: 26 additions & 0 deletions
26
spring-modulith-cli/.spring/commands/modulith/init/add-event-publication-registry.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
actions: | ||
# if: enable-event-publication-registry | ||
- exec: | ||
command: ./mvnw dependency:list | grep 'jakarta.persistence-api' || echo '' | ||
define: | ||
name: jpa-present | ||
- exec: | ||
command: ./mvnw dependency:list | grep 'spring-jdbc' || echo '' | ||
define: | ||
name: spring-jdbc-present | ||
- exec: | ||
command: ./mvnw dependency:list | grep 'spring-data-mongodb' || echo '' | ||
define: | ||
name: spring-data-mongodb-present | ||
- inject-maven-dependency: | ||
text: | | ||
<dependency> | ||
<groupId>org.springframework.modulith</groupId> | ||
{{#if jpa-present}} | ||
<artifactId>spring-modulith-starter-jpa</artifactId> | ||
{{else if spring-jdbc-present}} | ||
<artifactId>spring-modulith-starter-jdbc</artifactId> | ||
{{else if spring-jdbc-present}} | ||
<artifactId>spring-modulith-starter-mongodb</artifactId> | ||
{{/if}} | ||
</dependency> |
10 changes: 10 additions & 0 deletions
10
spring-modulith-cli/.spring/commands/modulith/init/command.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
command: | ||
description: Initializes Spring Modulith | ||
options: | ||
- name: enable-event-publication-registry | ||
description: Valid values ["jdbc", "jpa", "mongodb"] | ||
dataType: string | ||
- name: enable-observability | ||
description: Whether to include the modules for observability. | ||
dataType: boolean | ||
defaultValue: false |
24 changes: 24 additions & 0 deletions
24
spring-modulith-cli/.spring/commands/modulith/init/init-spring-modulith.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
actions: | ||
- inject-maven-dependency-management: | ||
text: | | ||
<dependency> | ||
<groupId>org.springframework.modulith</groupId> | ||
<artifactId>spring-modulith-bom</artifactId> | ||
<version>1.1.0</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
- inject-maven-dependency: | ||
text: | | ||
<dependency> | ||
<groupId>org.springframework.modulith</groupId> | ||
<artifactId>spring-modulith-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
{{#if enable-observability}} | ||
<dependency> | ||
<groupId>org.springframework.modulith</groupId> | ||
<artifactId>spring-modulith-starter-insight</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
= Spring Modulith CLI Integration | ||
|
||
This module contains the Spring CLI integration for Spring Modulith. | ||
To install the Spring Modulith support into the CLI, issue `command add` and point it to this repo: | ||
|
||
[source, bash] | ||
---- | ||
$ command add https://github.com/spring-projects/spring-modulith/tree/main/spring-modulith-cli | ||
---- | ||
|
||
Verify the commands have been installed correctly by issuing `help`. | ||
|
||
== Commands | ||
|
||
=== Initializing Spring Modulith | ||
|
||
`modulith init` initializes Spring Modulith with the current project. | ||
|
||
|
||
[source] | ||
---- | ||
NAME | ||
modulith init - Initializes Spring Modulith | ||
SYNOPSIS | ||
modulith init --enable-event-publication-registry String --enable-observability Boolean --help | ||
OPTIONS | ||
--enable-event-publication-registry String | ||
Valid values ["jdbc", "jpa", "mongodb"] | ||
[Optional] | ||
--enable-observability Boolean | ||
Whether to include the modules for observability. | ||
[Optional, default = false] | ||
--help or -h | ||
help for modulith init | ||
[Optional] | ||
---- | ||
|
||
=== Adding an Application Module | ||
|
||
`modulith add-module` adds a new application module to the application, including: | ||
|
||
* A new Java package with the given name. | ||
* A Spring component named after the module. | ||
* An `@ApplicationModuleTest` in the application module package in the test sources. | ||
|
||
[source] | ||
---- | ||
NAME | ||
modulith add-module - Add an application module | ||
SYNOPSIS | ||
modulith add-module [--name String] --help | ||
OPTIONS | ||
--name String | ||
The name of the application module. | ||
[Mandatory] | ||
--help or -h | ||
help for modulith add-module | ||
[Optional] | ||
---- | ||
|
||
=== Adding an Application Module Listener | ||
|
||
`modulith add-listener` | ||
|
||
[source] | ||
---- | ||
NAME | ||
modulith add-listener - Add an application module listener | ||
SYNOPSIS | ||
modulith add-listener [--module String] [--name String] [--eventType String] --help | ||
OPTIONS | ||
--module String | ||
The name of the module to create the listener in. | ||
[Mandatory] | ||
--name String | ||
The name of the listener type. | ||
[Mandatory] | ||
--eventType String | ||
The event type to listen to. | ||
[Mandatory] | ||
--help or -h | ||
help for modulith add-listener | ||
[Optional] | ||
---- |