diff --git a/nflow-examples/spring-boot/bare-minimum/build.gradle b/nflow-examples/spring-boot/bare-minimum/build.gradle index 2988d9ee6..a2aca3d85 100644 --- a/nflow-examples/spring-boot/bare-minimum/build.gradle +++ b/nflow-examples/spring-boot/bare-minimum/build.gradle @@ -1,6 +1,6 @@ plugins { - id "com.github.ben-manes.versions" version "0.22.0" - id 'org.springframework.boot' version '2.1.7.RELEASE' + id "com.github.ben-manes.versions" version "0.27.0" + id 'org.springframework.boot' version '2.2.1.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' } @@ -16,7 +16,7 @@ repositories { dependencies { compile('org.springframework.boot:spring-boot-starter-jdbc') - compile("io.nflow:nflow-engine:5.7.0") + compile("io.nflow:nflow-engine:6.0.0") runtime('com.h2database:h2') testCompile('org.springframework.boot:spring-boot-starter-test') } diff --git a/nflow-examples/spring-boot/bare-minimum/gradle/wrapper/gradle-wrapper.properties b/nflow-examples/spring-boot/bare-minimum/gradle/wrapper/gradle-wrapper.properties index 4b7e1f3d3..958c63d19 100644 --- a/nflow-examples/spring-boot/bare-minimum/gradle/wrapper/gradle-wrapper.properties +++ b/nflow-examples/spring-boot/bare-minimum/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +# upgrading to 5.6 or newer breaks eclipse test classpath distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/nflow-examples/spring-boot/bare-minimum/src/main/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplication.java b/nflow-examples/spring-boot/bare-minimum/src/main/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplication.java index 0f91882a3..f35b1d6ab 100644 --- a/nflow-examples/spring-boot/bare-minimum/src/main/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplication.java +++ b/nflow-examples/spring-boot/bare-minimum/src/main/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplication.java @@ -1,12 +1,12 @@ package io.nflow.springboot.bareminimum; -import javax.annotation.PostConstruct; import javax.inject.Inject; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import io.nflow.engine.config.EngineConfiguration; @@ -15,30 +15,37 @@ @SpringBootApplication @Import(EngineConfiguration.class) -@ComponentScan("io.nflow.springbootbareminimum") public class SpringBootBareMinimumApplication { - @Inject - private WorkflowInstanceService workflowInstances; - - @Inject - private WorkflowInstanceFactory workflowInstanceFactory; - @Bean public ExampleWorkflow exampleWorkflow() { return new ExampleWorkflow(); } - @PostConstruct - public void createExampleWorkflowInstance() { - workflowInstances.insertWorkflowInstance(workflowInstanceFactory.newWorkflowInstanceBuilder() - .setType(ExampleWorkflow.TYPE) - .setExternalId("example") - .putStateVariable(ExampleWorkflow.VAR_COUNTER, 0) - .build()); + @Bean + public ApplicationRunner applicationRunner() { + return new ExampleApplicationRunner(); } public static void main(String[] args) { SpringApplication.run(SpringBootBareMinimumApplication.class, args); } + + public static class ExampleApplicationRunner implements ApplicationRunner { + + @Inject + private WorkflowInstanceService workflowInstances; + + @Inject + private WorkflowInstanceFactory workflowInstanceFactory; + + @Override + public void run(ApplicationArguments args) { + workflowInstances.insertWorkflowInstance(workflowInstanceFactory.newWorkflowInstanceBuilder() + .setType(ExampleWorkflow.TYPE) + .setExternalId("example") + .putStateVariable(ExampleWorkflow.VAR_COUNTER, 0) + .build()); + } + } } diff --git a/nflow-examples/spring-boot/bare-minimum/src/test/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplicationTests.java b/nflow-examples/spring-boot/bare-minimum/src/test/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplicationTests.java index 8a9c562c3..865781d1c 100644 --- a/nflow-examples/spring-boot/bare-minimum/src/test/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplicationTests.java +++ b/nflow-examples/spring-boot/bare-minimum/src/test/java/io/nflow/springboot/bareminimum/SpringBootBareMinimumApplicationTests.java @@ -11,7 +11,7 @@ public class SpringBootBareMinimumApplicationTests { @Test public void contextLoads() { - // just let SpringRunner load the context + // just check that context can be started } } diff --git a/nflow-examples/spring-boot/full-stack-kotlin/build.gradle.kts b/nflow-examples/spring-boot/full-stack-kotlin/build.gradle.kts index b88c46f35..d2455260e 100644 --- a/nflow-examples/spring-boot/full-stack-kotlin/build.gradle.kts +++ b/nflow-examples/spring-boot/full-stack-kotlin/build.gradle.kts @@ -23,10 +23,10 @@ fun DependencyHandler.nflow(name: String) = create( plugins { base - kotlin("jvm") version "1.3.31" - id("org.jetbrains.kotlin.plugin.spring") version "1.3.31" - id("org.springframework.boot") version "2.1.4.RELEASE" - id("io.spring.dependency-management") version "1.0.7.RELEASE" + kotlin("jvm") version "1.3.60" + id("org.jetbrains.kotlin.plugin.spring") version "1.3.61" + id("org.springframework.boot") version "2.2.1.RELEASE" + id("io.spring.dependency-management") version "1.0.8.RELEASE" } repositories { @@ -50,12 +50,12 @@ dependencies { testImplementation(kotlin("test")) testImplementation(springBoot("test")) - testImplementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") + testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.2") nflowExplorer( - group = "com.nitorcreations", + group = "io.nflow", name = "nflow-explorer", - version = "1.2.8", + version = "6.0.0", ext = "tar.gz" ) } diff --git a/nflow-examples/spring-boot/full-stack-kotlin/gradle/wrapper/gradle-wrapper.properties b/nflow-examples/spring-boot/full-stack-kotlin/gradle/wrapper/gradle-wrapper.properties index 4b7e1f3d3..94920145f 100644 --- a/nflow-examples/spring-boot/full-stack-kotlin/gradle/wrapper/gradle-wrapper.properties +++ b/nflow-examples/spring-boot/full-stack-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/nflow-examples/spring-boot/full-stack/build.gradle b/nflow-examples/spring-boot/full-stack/build.gradle index 9619c63f9..aecaa568f 100644 --- a/nflow-examples/spring-boot/full-stack/build.gradle +++ b/nflow-examples/spring-boot/full-stack/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'de.undercouch.download' version '4.0.0' - id "com.github.ben-manes.versions" version "0.22.0" - id 'org.springframework.boot' version '2.1.7.RELEASE' + id 'de.undercouch.download' version '4.0.2' + id "com.github.ben-manes.versions" version "0.27.0" + id 'org.springframework.boot' version '2.2.1.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' } @@ -23,10 +23,10 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-jersey' implementation 'org.springframework.boot:spring-boot-starter-jdbc' - compile("io.nflow:nflow-rest-api-jax-rs:5.7.0") + compile("io.nflow:nflow-rest-api-jax-rs:6.0.0") runtime('com.h2database:h2') testCompile('org.springframework.boot:spring-boot-starter-test') - nflowExplorer group: 'io.nflow', name: 'nflow-explorer', version: '5.7.0', ext: 'tar.gz' + nflowExplorer group: 'io.nflow', name: 'nflow-explorer', version: '6.0.0', ext: 'tar.gz' } task resolveNflowExplorer(type: Copy) { diff --git a/nflow-examples/spring-boot/full-stack/src/main/java/io/nflow/springboot/fullstack/SpringBootFullStackApplication.java b/nflow-examples/spring-boot/full-stack/src/main/java/io/nflow/springboot/fullstack/SpringBootFullStackApplication.java index f8cc7410d..c87c3c5a0 100644 --- a/nflow-examples/spring-boot/full-stack/src/main/java/io/nflow/springboot/fullstack/SpringBootFullStackApplication.java +++ b/nflow-examples/spring-boot/full-stack/src/main/java/io/nflow/springboot/fullstack/SpringBootFullStackApplication.java @@ -1,10 +1,11 @@ package io.nflow.springboot.fullstack; -import javax.annotation.PostConstruct; import javax.inject.Inject; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.server.ResourceConfig; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @@ -24,12 +25,6 @@ @Import(RestConfiguration.class) public class SpringBootFullStackApplication { - @Inject - private WorkflowInstanceService workflowInstances; - - @Inject - private WorkflowInstanceFactory workflowInstanceFactory; - @Bean public ExampleWorkflow exampleWorkflow() { return new ExampleWorkflow(); @@ -40,6 +35,11 @@ public JerseyResourceConfig jerseyResourceConfig() { return new JerseyResourceConfig(); } + @Bean + public ApplicationRunner applicationRunner() { + return new ExampleApplicationRunner(); + } + private static class JerseyResourceConfig extends ResourceConfig { public JerseyResourceConfig() { register(ArchiveResource.class); @@ -52,16 +52,25 @@ public JerseyResourceConfig() { } } - @PostConstruct - public void createExampleWorkflowInstance() { - workflowInstances.insertWorkflowInstance(workflowInstanceFactory.newWorkflowInstanceBuilder() - .setType(ExampleWorkflow.TYPE) - .setExternalId("example") - .putStateVariable(ExampleWorkflow.VAR_COUNTER, 0) - .build()); - } - public static void main(String[] args) { SpringApplication.run(SpringBootFullStackApplication.class, args); } + + public static class ExampleApplicationRunner implements ApplicationRunner { + + @Inject + private WorkflowInstanceService workflowInstances; + + @Inject + private WorkflowInstanceFactory workflowInstanceFactory; + + @Override + public void run(ApplicationArguments args) { + workflowInstances.insertWorkflowInstance(workflowInstanceFactory.newWorkflowInstanceBuilder() + .setType(ExampleWorkflow.TYPE) + .setExternalId("example") + .putStateVariable(ExampleWorkflow.VAR_COUNTER, 0) + .build()); + } + } } diff --git a/nflow-examples/spring-boot/full-stack/src/test/java/io/nflow/springboot/fullstack/SpringBootFullStackApplicationTests.java b/nflow-examples/spring-boot/full-stack/src/test/java/io/nflow/springboot/fullstack/SpringBootFullStackApplicationTests.java index e7f7777a6..08063e923 100644 --- a/nflow-examples/spring-boot/full-stack/src/test/java/io/nflow/springboot/fullstack/SpringBootFullStackApplicationTests.java +++ b/nflow-examples/spring-boot/full-stack/src/test/java/io/nflow/springboot/fullstack/SpringBootFullStackApplicationTests.java @@ -11,7 +11,7 @@ public class SpringBootFullStackApplicationTests { @Test public void contextLoads() { - // just let SpringRunner load the context + // just check that context can be started } }