A convenient dependency descriptor that you can include in your Spring Boot appication to configure a Memcached client.
memcached.servers=
@SpringBootApplication
@EnableMemcached
class Application {
.
.
}
If you want to use a specific connection settings, you can define a bean for it :
@SpringBootApplication
@EnableMemcached
class Application {
@Bean
public ConnectionFactory memcachedConnection() {
return new ConnectionFactoryBuilder()
.setDaemon(true)
.setFailureMode(FailureMode.Cancel)
.build();
}
}
The Memcached Spring Boot Starter has been published in Maven Central.
The Maven coordinates are:
<dependency>
<groupId>com.btmatthews.springboot</groupId>
<artifactId>memcached-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>
The Gradle coordinates are:
compile('com.btmatthews.springboot:memcached-spring-boot-starter:1.1.0-SNAPSHOT')
The Memcached Spring Boot Starter is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/memcached-spring-boot-starter.