Is there a way to use BOTH the spymemcached provider AND the elasticache provider at the same time?
<dependency>
<groupId>com.google.code.simple-spring-memcached</groupId>
<artifactId>spring-cache</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>com.google.code.simple-spring-memcached</groupId>
<artifactId>spymemcached-provider</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>com.google.code.simple-spring-memcached</groupId>
<artifactId>aws-elasticache-provider</artifactId>
<version>3.6.1</version>
</dependency>
It seems that it will not work because the elasticache provider has its own version of ConnectionFactoryBuilder that it uses to set up dynamic discovery.
Both the ConnectionFactoryBuilder from spymemcached and elasticache use the same package namespace.
When both providers are included as a dependency they conflict and java finds the spymemcached first and produces a NoSuchMethodError when calling setClientMode.
My use case for needing both is that when my code is running in a local data center we use memcached, but when it is running in AWS then we want to use elasticache with dynamic discovery.
My app is a spring boot app and so both jar files are packaged in the uber-jar.
I use @Profile annotations to either include or exclude the appropriate beans based on the spring active profiles.
Is there maybe another way to approach this?