File tree Expand file tree Collapse file tree 1 file changed +44
-1
lines changed Expand file tree Collapse file tree 1 file changed +44
-1
lines changed Original file line number Diff line number Diff line change 1
- # spring-boot-shedlock
1
+ # spring-boot-shedlock
2
+
3
+ ### Step 1: Add Dependencies
4
+ Add the necessary ShedLock dependencies to your pom.xml:
5
+ ```
6
+ <!-- ShedLock Core -->
7
+ <dependency>
8
+ <groupId>net.javacrumbs.shedlock</groupId>
9
+ <artifactId>shedlock-spring</artifactId>
10
+ <version>5.8.0</version>
11
+ </dependency>
12
+
13
+ <!-- ShedLock for JDBC (PostgreSQL, MySQL, etc.) -->
14
+ <dependency>
15
+ <groupId>net.javacrumbs.shedlock</groupId>
16
+ <artifactId>shedlock-provider-jdbc-template</artifactId>
17
+ <version>5.8.0</version>
18
+ </dependency>
19
+
20
+ <!-- Spring Boot JDBC Starter (If not already included) -->
21
+ <dependency>
22
+ <groupId>org.springframework.boot</groupId>
23
+ <artifactId>spring-boot-starter-jdbc</artifactId>
24
+ </dependency>
25
+ ```
26
+
27
+ ### Step 2: Configure the ShedLock Table
28
+ Since ShedLock requires a database to store lock records, create the following table:
29
+ ```
30
+ CREATE TABLE shedlock (
31
+ name VARCHAR(64) PRIMARY KEY,
32
+ lock_until TIMESTAMP NOT NULL,
33
+ locked_at TIMESTAMP NOT NULL DEFAULT NOW(),
34
+ locked_by VARCHAR(255) NOT NULL
35
+ );
36
+ ```
37
+ ### Run Multiple Instances Using Command Line
38
+ Use the -Dspring-boot.run.arguments option to specify different configurations for each instance.
39
+ ```
40
+ mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8081"
41
+ ```
42
+ ```
43
+ mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8082"
44
+ ```
You can’t perform that action at this time.
0 commit comments