# errorgap for Java / Spring Boot

See [index.md](./index.md) for API details and the placeholder values (`ERRORGAP_API_KEY`, `ERRORGAP_ENDPOINT`, `ERRORGAP_PROJECT_SLUG`).

SDK source: `github.com/errorgaphq/errorgap-java` · current version: `0.2.0`. Requires Java 17+.

## Install (Maven)

```xml
<dependency>
  <groupId>com.errorgap</groupId>
  <artifactId>errorgap-spring-boot-starter</artifactId>
  <version>0.2.0</version>
</dependency>
```

For non-Spring apps, depend on `errorgap-core` instead.

## Configure (Spring Boot)

`application.properties`:

```properties
errorgap.endpoint=${ERRORGAP_ENDPOINT}
errorgap.project-slug=${ERRORGAP_PROJECT_SLUG}
errorgap.api-key=${ERRORGAP_API_KEY}
errorgap.environment=production
errorgap.release=@project.version@
```

The starter auto-configures gated on `errorgap.project-slug` and registers an MVC `HandlerExceptionResolver` at the highest precedence that reports controller exceptions before delegating to the framework's renderer.

## Configure (plain Java)

```java
import com.errorgap.Configuration;
import com.errorgap.Errorgap;

Configuration cfg = new Configuration()
    .setEndpoint(System.getenv("ERRORGAP_ENDPOINT"))
    .setProjectSlug(System.getenv("ERRORGAP_PROJECT_SLUG"))
    .setApiKey(System.getenv("ERRORGAP_API_KEY"));
Errorgap.init(cfg);
```

## Trigger a test error

```java
@GetMapping("/errorgap-test")
public String errorgapTest() {
    throw new RuntimeException("Errorgap test error");
}
```

## Verify

Run the verification curl from [index.md](./index.md), then hit `/errorgap-test` and confirm the onboarding screen advances.
