From ea7565be5061ced41382c4e142fdeb43b30b5a9a Mon Sep 17 00:00:00 2001 From: Stephan Pelikan Date: Mon, 29 Jan 2024 09:44:38 +0100 Subject: [PATCH] Improve startup performance --- spring-boot/pom.xml | 2 +- .../camunda8/Camunda8AdapterConfiguration.java | 15 ++++++++++++++- .../camunda8/wiring/Camunda8TaskWiring.java | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 831cfad..fe40353 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -35,7 +35,7 @@ io.vanillabp spring-boot-support - 1.0.7 + 1.0.8-SNAPSHOT io.camunda diff --git a/spring-boot/src/main/java/io/vanillabp/camunda8/Camunda8AdapterConfiguration.java b/spring-boot/src/main/java/io/vanillabp/camunda8/Camunda8AdapterConfiguration.java index cb2fee4..2f10d43 100644 --- a/spring-boot/src/main/java/io/vanillabp/camunda8/Camunda8AdapterConfiguration.java +++ b/spring-boot/src/main/java/io/vanillabp/camunda8/Camunda8AdapterConfiguration.java @@ -12,6 +12,7 @@ import io.vanillabp.camunda8.wiring.Camunda8TaskWiring; import io.vanillabp.camunda8.wiring.Camunda8UserTaskHandler; import io.vanillabp.springboot.adapter.AdapterConfigurationBase; +import io.vanillabp.springboot.adapter.SpringBeanUtil; import io.vanillabp.springboot.adapter.SpringDataUtil; import io.vanillabp.springboot.adapter.VanillaBpProperties; import io.vanillabp.springboot.parameters.MethodParameter; @@ -25,6 +26,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigurationPackage; import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Scope; @@ -94,12 +96,14 @@ public Camunda8DeploymentAdapter camunda8Adapter( @Bean public Camunda8TaskWiring camunda8TaskWiring( final SpringDataUtil springDataUtil, + final SpringBeanUtil springBeanUtil, final Camunda8UserTaskHandler userTaskHandler, final ObjectProvider taskHandlers) { return new Camunda8TaskWiring( springDataUtil, applicationContext, + springBeanUtil, applicationName, workerId, userTaskHandler, @@ -165,5 +169,14 @@ public Camunda8ProcessService newProcessServiceImplementation( return result; } - + + @Bean + @ConditionalOnMissingBean + public SpringBeanUtil vanillabpSpringBeanUtil( + final ApplicationContext applicationContext) { + + return new SpringBeanUtil(applicationContext); + + } + } diff --git a/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java b/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java index 8b858a0..7b46c9a 100644 --- a/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java +++ b/spring-boot/src/main/java/io/vanillabp/camunda8/wiring/Camunda8TaskWiring.java @@ -15,6 +15,7 @@ import io.vanillabp.camunda8.wiring.parameters.Camunda8MethodParameterFactory; import io.vanillabp.camunda8.wiring.parameters.ParameterVariables; import io.vanillabp.spi.service.WorkflowTask; +import io.vanillabp.springboot.adapter.SpringBeanUtil; import io.vanillabp.springboot.adapter.SpringDataUtil; import io.vanillabp.springboot.adapter.TaskWiringBase; import io.vanillabp.springboot.parameters.MethodParameter; @@ -23,6 +24,7 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.context.ApplicationContext; +import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; @@ -57,13 +59,14 @@ public class Camunda8TaskWiring extends TaskWiringBase taskHandlers, final Collection> connectableServices) { - super(applicationContext, new Camunda8MethodParameterFactory()); + super(applicationContext, springBeanUtil, new Camunda8MethodParameterFactory()); this.workerId = workerId; this.applicationName = applicationName; this.springDataUtil = springDataUtil; @@ -287,7 +290,7 @@ private String getWorkflowAggregateIdPropertyName( .stream(workflowAggregateClass.getDeclaredFields()) .filter(field -> field.getAnnotation(Id.class) != null) .findFirst() - .map(field -> field.getName()) + .map(Field::getName) .orElse(Arrays .stream(workflowAggregateClass.getDeclaredMethods()) .filter(method -> method.getAnnotation(Id.class) != null)