Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 1.1 KB

File metadata and controls

41 lines (30 loc) · 1.1 KB

Spring Boot starter for Segment Analytics

This module provides a Spring Boot starter for the Segment client.

Usage

For Maven, include this dependency in your pom.xml:

<dependency>
  <groupId>com.segment.analytics.java</groupId>
  <artifactId>analytics-spring-boot-starter</artifactId>
  <version>${segment.analytics.version}</version>
</dependency>

For Gradle,

compile 'com.segment.analytics.java:analytics-spring-boot-starter:+'

In your Spring Boot configuration (application.properties, environment, or similar), provide the property segment.analytics.writeKey. The autoconfiguration will register an Analytics bean in the Spring context ready for use.

Customization

To customize the Analytics client you can define a SegmentAnalyticsCustomizer bean, which receives the builder instance.

For example if you want to use a regional endpoint you can define a customizer like so:

@Bean
SegmentAnalyticsCustomizer segmentAnalyticsCustomizer() {
    return builder -> builder.endpoint("events.eu1.segmentapis.com");
}