Skip to content

Commit 1d52a42

Browse files
authored
Update README.md
1 parent 8a8a4a5 commit 1d52a42

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
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+
```

0 commit comments

Comments
 (0)