【发布时间】:2019-02-26 19:55:38
【问题描述】:
如何使用 Terracotta 4.3.6 配置阔叶演示?
我在 Broadleaf 中使用的 EhCache 版本是 2.10.4。
Broadleaf 演示版本为 5.2.0-GA。
【问题讨论】:
标签: spring-boot broadleaf-commerce terracotta ehcache-2
如何使用 Terracotta 4.3.6 配置阔叶演示?
我在 Broadleaf 中使用的 EhCache 版本是 2.10.4。
Broadleaf 演示版本为 5.2.0-GA。
【问题讨论】:
标签: spring-boot broadleaf-commerce terracotta ehcache-2
从此link 下载 Terracotta 服务器。 使用路径“server\bin”中的 start-tc-server.bat 文件启动服务器。
在父pom.xml中添加如下代码
<repositories>
<repository>
<id>terracotta-repository</id>
<url>http://www.terracotta.org/download/reflector/releases</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
在核心中,在 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>
要覆盖 Broadleaf ehcache,请在您的服务配置中添加以下代码
@Merge("blMergedCacheConfigLocations")
public List<String> adminOverrideCache() {
return Arrays.asList("classpath:bl-override-ehcache.xml");
}
在你的类路径中添加文件“bl-override-ehcache.xml”,代码如下
<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>
【讨论】: