setting up Activiti BPMN Workflow Engine with Spring Boot - 指南
spring.activiti.database-schema-update: true
Controlshow Activiti handles its database tableson startup.
Options:
true– Default. Creates or updatestables automatically if missing. ✅ Good fordevelopment.false– Disables auto-update. Throws an error if tables are missing or version mismatch. ❌ For production.create_drop– Creates tables on start and drops them on shutdown. ⚠️ Risky, only for testing.drop-create– Drops existing tables and creates new ones every time app starts.
spring.activiti.db-history-used: true
EnablesActiviti's history tables.
These store past process execution info (like who approved what and when).
Without this, even with
history-levelset, no history tables are created.
spring.activiti.history-level: full
Defineshow much historyActiviti saves.
Options:
none– No history (best performance).activity– Saves basic activity instance data.audit– Adds task infolike who did what.full– Saves everything, including variables and execution details. ✅ Best fordebugging/auditing.
spring.activiti.check-process-definitions: false
Whether toautomatically scan and deploy BPMN process files from
resources/processes/.false– You must manually deployprocesses (e.g., via code or REST).✅ Useful when youdon’t want automatic redeployments(e.g., in production).
spring.activiti.deployment-mode: never-fail
Controlsdeployment conflict handling:
default– May fail if process definition is already deployed.single-resource– Deploys each file separately.never-fail– Ignores duplicate deployments, avoids errors.
✅ Safer option toprevent deployment exceptionsduring startup.
⏱ spring.activiti.async-executor-activate: false
Controlswhether the async executor is started.
Async executor handlesasynchronous jobs and timersin workflows.
false– Disables it.✅ Disable if you don’t use timers/events to avoid unnecessary thread usage.
✅ Summary (recommended for dev)
| Setting | Value | Meaning |
|---|---|---|
database-schema-update | true | Auto-create/update tables |
db-history-used | true | Enable history tables |
history-level | full | Save full execution history |
check-process-definitions | false | Don’t auto-load BPMN files |
deployment-mode | never-fail | Avoid deployment errors on startup |
async-executor-activate | false | Don’t start async job processor |
浙公网安备 33010602011771号