---
title: "Migrating Version 1.x to 4.x"
description: "Learn about migrating from version 1.x to 4.x"
url: https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/
---

# Migrating Version 1.x to 4.x | Sentry for Spring Boot

## [Migrating from `io.sentry:sentry` `1.x` to `io.sentry:sentry` `4.x`](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#migrating-from-iosentrysentry-1x-to-iosentrysentry-4x)

Our update to the API follows the [Unified API](https://develop.sentry.dev/sdk/miscellaneous/unified-api/) more closely. It's a completely updated code base, written to support our Android SDK.

### [API Changes](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#api-changes)

#### [Set tag](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#set-tag)

*Previous*:

```java
Sentry.getContext().addTag("tagName", "tagValue");
```

*Updated*:

```java
Sentry.setTag("tagName", "tagValue");
```

#### [Capture custom exception](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#capture-custom-exception)

*Previous*:

```java
try {
  int x = 1 / 0;
} catch (Exception e) {
  Sentry.capture(e);
}
```

*New*:

```java
try {
  int x = 1 / 0;
} catch (Exception e) {
  Sentry.captureException(e);
}
```

#### [Capture a message](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#capture-a-message)

*Previous*:

```java
Sentry.capture("This is a test");
```

*New*:

```java
Sentry.captureMessage("This is a test"); // SentryLevel.INFO by default
Sentry.captureMessage("This is a test", SentryLevel.WARNING); // or specific level
```

#### [Breadcrumbs](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#breadcrumbs)

*Previous*:

```java
Sentry.getContext().recordBreadcrumb(
  new BreadcrumbBuilder().setMessage("User made an action").build()
);
```

*New*:

```java
Sentry.addBreadcrumb("User made an action");
```

#### [User](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#user)

*Previous*:

```java
Sentry.getContext().setUser(
  new UserBuilder().setEmail("hello@sentry.io").build()
);
```

*New*:

```java
User user = new User();
user.setEmail("hello@sentry.io");
Sentry.setUser(user);
```

#### [Set extra](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#set-extra)

*Previous*:

```java
Sentry.getContext().addExtra("extra", "thing");
```

*New*:

```java
Sentry.setExtra("extra", "thing");
```

### [Removed Properties](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#removed-properties)

Following configuration properties have been removed:

* `buffer.dir` - can be set with `SentryOptions#cacheDirPath`
* `buffer.size` - can be set with `SentryOptions#cacheDirSize`
* `buffer.flushtime` - can be set with `SentryOptions#flushTimeoutMillis`
* `buffer.shutdowntimeout`
* `buffer.gracefulshutdown`
* `async`
* `async.shutdowntimeout` - can be set with `SentryOptions#shutdownTimeout`
* `async.gracefulshutdown`
* `async.queuesize` - can be set with `SentryOptions#maxQueueSize`
* `async.threads`
* `async.priority`
* `compression`
* `maxmessagelength`
* `factory`
* `mdcTags`
* `extra` - can be set on the scope with `Scope#extra`

### [Property Name Changes](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#property-name-changes)

Following properties cannot be set anymore through external configuration and have to be set directly on `SentryOptions` object when initializing Sentry:

* `sample.rate` - through `SentryOptions#sampleRate`
* `timeout` - through `SentryOptions#connectionTimeoutMillis` and `SentryOptions#readTimeoutMillis`

See [Configuration](https://docs.sentry.io/platforms/java/guides/spring-boot/configuration.md) page to find all available configuration properties.

#### [Tags](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#tags)

*Previous*:

```properties
tags=tag1:value1,tag2:value2
```

*New*:

```properties
tags.tag1=value1
tags.tag2=value2
```

#### [“In Application” Stack Frames](https://docs.sentry.io/platforms/java/guides/spring-boot/migration/1.x-to-4.x/#in-application-stack-frames)

```java
stacktrace.app.packages=com.mycompany,com.other.name
```

*New*:

```properties
in-app-includes=com.mycompany,com.other.name
```

There is also an option to exclude certain packages from stack traces:

```properties
in-app-excludes=com.packages.to.exclude
```
