How to configure the broadleaf demo with Terracotta 4.3.6?
EhCache version I am using in broadleaf is 2.10.4.
Broadleaf demo version is 5.2.0-GA.
Download the Terracotta server from this link. Start the server using the start-tc-server.bat file available in path "server\bin".
Add the following code in the parent pom.xml
<repositories>
<repository>
<id>terracotta-repository</id>
<url>http://www.terracotta.org/download/reflector/releases</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
In core, add the below dependencies in pom.xml
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-terracotta</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>terracotta-toolkit-1.5-runtime</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>terracotta-toolkit-runtime</artifactId>
<version>4.3.2</version>
</dependency>
To override broadleaf ehcache add below code in your service configuration
@Merge("blMergedCacheConfigLocations")
public List<String> adminOverrideCache() {
return Arrays.asList("classpath:bl-override-ehcache.xml");
}
Add the file "bl-override-ehcache.xml" in your classpath, with below code
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect">
<!-- Terracota server url -->
<terracottaConfig url="localhost:9510" />
</ehcache>