Connect Spring Boot to Bugsink
The Spring Boot integration reports unhandled controller exceptions with their route, HTTP request, Spring transaction, and application stack.
This guide adds the integration to an existing Spring Boot application and triggers a deliberate controller failure. To follow along, create a Bugsink project and copy its DSN from the project setup page.
Install the SDK
Add the open-source Sentry starter for your Spring Boot version. Bugsink accepts the Sentry event protocol, so the SDK can send events directly to your Bugsink project. Spring Boot 4 applications need the Boot 4 starter:
<dependency> <groupId>io.sentry</groupId> <artifactId>sentry-spring-boot-4-starter</artifactId> <version>${sentry.version}</version> </dependency><dependency> <groupId>io.sentry</groupId> <artifactId>sentry-spring-boot-4-starter</artifactId> <version>${sentry.version}</version> </dependency>
Configure your DSN
Add the DSN to application.properties. Reading it from the environment keeps
the value out of source control, while Spring Boot makes it available when the
integration starts:
sentry.dsn=${SENTRY_DSN:}sentry.dsn=${SENTRY_DSN:}
Set SENTRY_DSN to the DSN shown by your Bugsink project:
export SENTRY_DSN=https://key@bugsink.example/1export SENTRY_DSN=https://key@bugsink.example/1
Send a test error
Temporarily throw an exception in a controller action you can request. The controller does not need a Bugsink-specific call; the integration sees the unhandled exception as it leaves Spring MVC:
if (!INVENTORY.containsKey(sku)) { throw new ProductNotFound("Product " + sku + " is not in inventory"); }if (!INVENTORY.containsKey(sku)) { throw new ProductNotFound("Product " + sku + " is not in inventory"); }
Start the application with its DSN, then request that action once:
mvn spring-boot:run :::bash curl http://127.0.0.1:8080/checkout/java-missingmvn spring-boot:run :::bash curl http://127.0.0.1:8080/checkout/java-missing
The exception still follows Spring Boot’s normal error handling. The request returns its usual 500 response while the integration reports the failure to Bugsink.
See the error in Bugsink
Open your Bugsink project. The new ProductNotFound issue contains the request,
the parameterized Spring route, and the controller frame which raised it.
ProductNotFound
That’s it: unhandled Spring Boot controller exceptions will now be reported to Bugsink. Remove the deliberate exception; the integration remains active for future request failures.
For handled exceptions, messages, tags, structured context, breadcrumbs, and short-lived Java processes, continue with the Java guide.
