【问题标题】:JHipster test: NoCacheRegionFactoryAvailableException when second level cache is disabledJHipster 测试:禁用二级缓存时出现 NoCacheRegionFactoryAvailableException
【发布时间】:2016-10-21 21:31:43
【问题描述】:

当我使用 jhipster 生成应用程序时,我禁用了二级缓存。但是,当我运行“gradle test”或“run as junit test”来测试应用程序时,由于“NoCacheRegionFactoryAvailableException”而失败。我已经检查了目录“src/test/resources/config”中的 application.yml,并确保第二个缓存被禁用。我不知道为什么该应用程序仍在寻找第二缓存。有什么线索是怎么发生的吗?或者如何完全禁用二级缓存?

除了测试失败,其他一切正常,应用可以成功运行。

src/test/resources/config 中的application.yml

spring:
    application:
        name: EMS
    datasource:
        url: jdbc:h2:mem:EMS;DB_CLOSE_DELAY=-1
        name:
        username:
        password:
    jpa:
        database-platform: com.espion.ems.domain.util.FixedH2Dialect
        database: H2
        open-in-view: false
        show_sql: true
        hibernate:
            ddl-auto: none
            naming-strategy: org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy
        properties:
            hibernate.cache.use_second_level_cache: false
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: true
            hibernate.hbm2ddl.auto: validate
    data:
        elasticsearch:
            cluster-name:
            cluster-nodes:
            properties:
                path:
                  logs: target/elasticsearch/log
                  data: target/elasticsearch/data
    mail:
        host: localhost
    mvc:
        favicon:
            enabled: false
    thymeleaf:
        mode: XHTML
liquibase:
    contexts: test

security:
    basic:
        enabled: false

server:
    port: 10344
    address: localhost

jhipster:
    async:
        corePoolSize: 2
        maxPoolSize: 50
        queueCapacity: 10000
    security:
        rememberMe:
            # security key (this key should be unique for your application, and kept secret)
            key: jhfasdhflasdhfasdkfhasdjkf
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
    swagger:
        title: EMS API
        description: EMS API documentation
        version: 0.0.1
        termsOfServiceUrl:
        contactName:
        contactUrl:
        contactEmail:
        license:
        licenseUrl:
        enabled: false

【问题讨论】:

    标签: gradle junit ehcache jhipster


    【解决方案1】:

    src/test/resources/config/application.yml 移动到src/test/resources 目录。

    您可以从https://github.com/jhipster/generator-jhipster/issues/3730 找到该解决方案

    【讨论】:

      猜你喜欢
      • 2019-04-02
      • 2016-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-01
      • 1970-01-01
      • 2014-01-09
      • 2018-07-30
      相关资源
      最近更新 更多