This module provides a Spring Boot starter for the Segment client.
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.
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");
}