Search code examples
javaspringjdbcscheduled-tasksshedlock

Can Shedlock be used in a non Spring-boot app?


I've been trying to get Shedlock set up so that a certain process is only ever run from 1 instance of the app at a time, the app uses some springframework dependencies, but is not a spring-boot app.

I've made the db table, set up the configuration, and annotated my tasks. I've been having issues, the lock name not showing up in the shedlock table, and think there may be an issue with my configuration. The app doesn't have an application.yml file to define the datasource, but I've been trying to work around that. I just want to see if this is actually possible for an app that isn't a spring-boot app, or if I need to find an alternative.


Solution

  • Yes, it is possible to use ShedLock in plain Spring without Spring Boot. You just need to have JDBC DataSource configured, and all dependencies needed for AOP. You can even use it completely without a framework.