Skip to content

SpringBoot配置项设置本地缓存为false不生效 #27

@XuHaodong-github

Description

@XuHaodong-github
@Configuration
public class IdAutoConfig {
    @Value("${mybatis-plus.zookeeper.serverLists}")
    private String zkServerLists;

    @Bean
    public IdentifierGenerator idGenerator() {
        // 设置zk服务器地址
        ZookeeperConfiguration zookeeperConfiguration = new ZookeeperConfiguration();
        zookeeperConfiguration.setServerLists(zkServerLists);
        // 设置本地缓存和序列化方式
        ApplicationConfiguration applicationConfiguration = new ApplicationConfiguration();
        applicationConfiguration.setCacheable(false);
        applicationConfiguration.setSerialize(SerializeStrategy.SERIALIZE_JSON_JACKSON);
        // 创建idworker实例
        return new ImadcnIdentifierGenerator(zookeeperConfiguration, applicationConfiguration);
    }
}

tmp/idworker/default.cache
每次项目启动运行之后还是会在项目目录里生成这个缓存文件,有什么方法能够不生成吗

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions