flowable / flowable/flowable-engine

IdmBootstrapper not triggered

Open
#3,181 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

**Describe the bug**
IdmBootstrapper using `event.getApplicationContext().getParent() == null` to avoid multiple child contexts refreshed event, but in my project, create admin user not be triggered. maybe because i use nacos as configuration, all ApplicationContext has a parent?
I change the code as fowllowing, it works well.
```java
@Autowired
ApplicationContext applicationContext;

@EventListener
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext().equals(this.applicationContext)) {
System.out.println("Fired only once!");
}
}
````

**Code**
```java
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext().getParent() == null) { // Using Spring MVC, there are multiple child contexts. We only care about the root

if ((ldapProperties == null || !ldapProperties.isEnabled()) && !idmAppProperties.getKeycloak().isEnabled()) {
if (idmAppProperties.isBootstrap()) {
// First create the default IDM entities
createDefaultAdminUserAndPrivileges();
}

} else {
```

**Additional context**
Flowable: 6.7.2
Springboot: 2.6.2

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.