I use timer start event and want to set duration value from application.yaml.
I tried setting ${application.issueSessionTimeout}, but it doesn’t work.
Result:
org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'application'
My application.yaml:
application:
issueSessionTimeout: PT30M
Hi,
in many model properties you can use SpEL expressions to access components defined in Spring. The SpEL refers to something available in Spring - let’s call it a bean. Properties from your configuration (YML or properties file) may be exposed as beans. For doing so you need to define a class and bind it. Something like this:
@ConfigurationProperties(prefix="application")
@Data // lombok or define getters setters
public class ApplicationProperties {
private String issueSessionTimeout;
}
To activate properties binding and expose the properties class to your configuration of Spring Boot, you will need the following:
@Configuration
@EnableConfigurationProperties(ApplicationProperties.class)
public class ApplicationConfiguration {
@Bean
// the name of this method is the name of the bean, or you pass it
// into the @Bean annotation.
public ApplicationProperites application(ApplicationProperites properties) {
return this;
}
}
By doing all this, you create a bean factory which will create a Spring Bean called application
available in your Spring Context. Now you can reference this Bean from your SpEL expressions (overall, and in process models too).
Hope this helps,
Cheers,
Simon