Skip to content

Commit dff3b04

Browse files
committed
Added example spring boot application
1 parent 07b8eb2 commit dff3b04

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

samples/example-spring-boot-app/pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,40 @@
88
<artifactId>example-spring-boot-app</artifactId>
99
<version>1.0-SNAPSHOT</version>
1010

11+
<parent>
12+
<groupId>org.springframework.boot</groupId>
13+
<artifactId>spring-boot-starter-parent</artifactId>
14+
<version>2.3.4.RELEASE</version>
15+
</parent>
1116

17+
<dependencies>
18+
<dependency>
19+
<groupId>com.exceptionless</groupId>
20+
<artifactId>exceptionless-client</artifactId>
21+
<version>1.0-beta1</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-starter-web</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>com.squareup.okhttp3</groupId>
29+
<artifactId>okhttp</artifactId>
30+
<version>4.9.1</version>
31+
</dependency>
32+
</dependencies>
33+
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-compiler-plugin</artifactId>
39+
<version>3.5.1</version>
40+
<configuration>
41+
<source>11</source>
42+
<target>11</target>
43+
</configuration>
44+
</plugin>
45+
</plugins>
46+
</build>
1247
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.exceptionless.example.spring.boot.app;
2+
3+
import com.exceptionless.exceptionlessclient.ExceptionlessClient;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.context.annotation.Bean;
7+
8+
@SpringBootApplication
9+
public class ExampleAPI {
10+
public static void main(String[] args) {
11+
SpringApplication.run(ExampleAPI.class, args);
12+
}
13+
14+
@Bean
15+
public ExceptionlessClient exceptionlessClient() {
16+
return ExceptionlessClient.from(
17+
System.getenv("EXCEPTIONLESS_SAMPLE_APP_API_KEY"),
18+
System.getenv("EXCEPTIONLESS_SAMPLE_APP_SERVER_URL"));
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.exceptionless.example.spring.boot.app.api;
2+
3+
import com.exceptionless.exceptionlessclient.ExceptionlessClient;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.http.HttpStatus;
6+
import org.springframework.web.bind.annotation.PostMapping;
7+
import org.springframework.web.bind.annotation.RequestMapping;
8+
import org.springframework.web.bind.annotation.ResponseStatus;
9+
import org.springframework.web.bind.annotation.RestController;
10+
11+
@RestController
12+
@RequestMapping("/test")
13+
public class ExampleResource {
14+
private final ExceptionlessClient exceptionlessClient;
15+
16+
@Autowired
17+
public ExampleResource(ExceptionlessClient exceptionlessClient) {
18+
this.exceptionlessClient = exceptionlessClient;
19+
}
20+
21+
@PostMapping("/log")
22+
@ResponseStatus(HttpStatus.ACCEPTED)
23+
public void submitLog() {
24+
exceptionlessClient.submitLog("test-log");
25+
}
26+
}

0 commit comments

Comments
 (0)