Where is the best place to set variables globally to be used across different bpmn files

@sharath.java525 If you follow microservices pattern, then the global variables can be set by creating a microservice for spring cloud config server. In config server we can create our variables and configuration in two ways.

  1. Configurations from GIT Link reference
  2. Using local file system / Environment variables.

For local file system: db.properties , db-test.properties , db-prod.properties , db-dev.properties. Like we can create any profiles for variables and configuration.

Or in the application initialize and cache the variables using hashmap.


@Component
public class ApplicationCache {
    public static Map<K, V> map = new HashMap<>();

    @PostConstruct
    public void init() {
            map.put(key, value);
        }
} 
 

Or if you want to add those static variables to every process, then you can provide a process engine plugin which will set those variables for every process instances.

Refer this example for writing process engine plugin :