move files into modules

This commit is contained in:
2026-06-06 15:07:03 +02:00
parent 00161b294c
commit cc66b7517b
88 changed files with 1090 additions and 79 deletions

View File

@@ -0,0 +1,45 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
#### added
*.png
*.dot
*.scxml.xml
Combined.java

View File

@@ -0,0 +1,42 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.3'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'click.kamil'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.statemachine:spring-statemachine-starter:3.2.0'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform()
}

View File

@@ -0,0 +1,49 @@
package click.kamil.examples.statemachine.dynamic;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.config.StateMachineBuilder;
import java.util.EnumSet;
public class DynamicStateMachineExample {
public enum States {
DRAFT, REVIEW, APPROVED
}
public enum Events {
SUBMIT, APPROVE
}
public static StateMachine<States, Events> buildStateMachine() throws Exception {
StateMachineBuilder.Builder<States, Events> builder = StateMachineBuilder.builder();
builder.configureStates()
.withStates()
.initial(States.DRAFT)
.end(States.REVIEW)
.states(EnumSet.allOf(States.class));
builder.configureTransitions()
.withExternal()
.source(States.DRAFT).target(States.REVIEW).event(Events.SUBMIT)
.and()
.withExternal()
.source(States.REVIEW).target(States.APPROVED).event(Events.APPROVE);
return builder.build();
}
public static void main(String[] args) throws Exception {
StateMachine<States, Events> sm = buildStateMachine();
sm.start();
System.out.println("Current State: " + sm.getState().getId());
sm.sendEvent(Events.SUBMIT);
System.out.println("After SUBMIT: " + sm.getState().getId());
sm.sendEvent(Events.APPROVE);
System.out.println("After APPROVE: " + sm.getState().getId());
}
}

View File

@@ -0,0 +1,11 @@
package click.kamil.examples.statemachine.dynamic.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
class StateMachineApplication {
public static void main(String[] args) {
SpringApplication.run(StateMachineApplication.class, args);
}
}

View File

@@ -0,0 +1 @@
spring.application.name=statemachinedemo

View File

@@ -0,0 +1,11 @@
package click.kamil.examples.statemachine;
import org.junit.jupiter.api.Test;
class MyTest {
@Test
void contextLoads() {
}
}