Skip to content

Commit 1281491

Browse files
committed
Create SpringBoot2.7Postgres
1 parent c552b5e commit 1281491

28 files changed

Lines changed: 1357 additions & 0 deletions

sample-apps/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Here is an overview of all of our sample apps together with their port numbers.
2222
- [SpringBoot MVC with Postgres (Kotlin)](./SpringMVCPostgresKotlin) on port [`8092`](http://localhost:8092/)
2323
- [SpringBoot MVC with Postgres (Groovy)](./SpringMVCPostgresGroovy) on port [`8094`](http://localhost:8094/)
2424
- [SpringBoot MVC With SQLite](./SpringBootSQLite) on port [`8100`](http://localhost:8100/)
25+
- [SpringBoot MVC v2.7 With Postgres](./SpringBoot2.7Postgres) on port [`8104`](http://localhost:8104/)
2526

2627
#### Webflux Apps
2728
- [SpringBoot Webflux with Postgres](./SpringWebfluxSampleApp) on port [`8090`](http://localhost:8090/)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**output**.log
2+
dd-java-agent**
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Define variables
2+
GRADLEW = ./gradlew
3+
JAR_FILE = build/libs/demo-0.0.1-SNAPSHOT.jar
4+
JAVA_AGENT = ../../dist/agent.jar
5+
6+
# Default target
7+
.PHONY: all
8+
all: build
9+
10+
# Build the project
11+
.PHONY: build
12+
build:
13+
@echo "Building the project..."
14+
chmod +x $(GRADLEW)
15+
$(GRADLEW) build
16+
17+
# Run the application with the Java agent
18+
.PHONY: run
19+
run: build
20+
@echo "Running SpringBoot2.7Postgres with Zen & ENV (http://localhost:8104)"
21+
AIKIDO_LOG_LEVEL="error" \
22+
AIKIDO_TOKEN="token" \
23+
AIKIDO_REALTIME_ENDPOINT="http://localhost:5000/realtime" \
24+
AIKIDO_ENDPOINT="http://localhost:5000" \
25+
AIKIDO_BLOCK=1 \
26+
nohup java -javaagent:$(JAVA_AGENT) -jar $(JAR_FILE) --server.port=8104 > output1.log &
27+
28+
.PHONY: runWithDdTrace
29+
runWithDdTrace: build
30+
@echo "Running SpringBoot2.7Postgres with Zen, ddtrace & ENV (http://localhost:8104)"
31+
wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
32+
AIKIDO_LOG_LEVEL="error" \
33+
AIKIDO_TOKEN="token" \
34+
AIKIDO_REALTIME_ENDPOINT="http://localhost:5000/realtime" \
35+
AIKIDO_ENDPOINT="http://localhost:5000" \
36+
AIKIDO_BLOCK=1 \
37+
nohup java -javaagent:dd-java-agent.jar -Ddd.profiling.enabled=true -Ddd.logs.injection=true -Ddd.service=my-app -Ddd.env=staging -Ddd.version=1.0 -javaagent:$(JAVA_AGENT) -jar $(JAR_FILE) --server.port=8104 > output1.log &
38+
39+
# Run the application without Zen
40+
.PHONY: runWithoutZen
41+
runWithoutZen: build
42+
@echo "Running SpringBootPostgres without Zen & ENV (http://localhost:8105)"
43+
AIKIDO_TOKEN="random-invalid-token" \
44+
nohup java -jar $(JAR_FILE) --server.port=8105 > output2.log &
45+
46+
# Clean the project
47+
.PHONY: clean
48+
clean:
49+
@echo "Cleaning the project..."
50+
$(GRADLEW) clean
51+
52+
.PHONY: kill
53+
kill:
54+
pkill -f java
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SpringBoot v2.7 +Postgres vulnerable sample app
2+
- Inserting a malicious dog : `Malicious Pet', 'Gru from the Minions') -- `
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '2.7.13'
4+
id 'io.spring.dependency-management' version '1.1.6'
5+
}
6+
7+
java {
8+
sourceCompatibility = '17'
9+
targetCompatibility = '17'
10+
}
11+
12+
group = 'com.example'
13+
version = '0.0.1-SNAPSHOT'
14+
15+
repositories {
16+
mavenCentral()
17+
}
18+
19+
dependencies {
20+
implementation files('../../dist/agent_api.jar')
21+
implementation 'org.springframework.boot:spring-boot-starter'
22+
implementation 'org.springframework.boot:spring-boot-starter-web'
23+
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
24+
compileOnly 'org.projectlombok:lombok'
25+
implementation 'org.postgresql:postgresql'
26+
annotationProcessor 'org.projectlombok:lombok'
27+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#This file is generated by updateDaemonJvm
2+
toolchainVersion=21
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

sample-apps/SpringBoot2.7Postgres/gradlew

Lines changed: 252 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)