当我使用jhipster生成一个应用程序时,我禁用了二级缓存。但是,当我运行"gradle test“或"run as junit test”来测试应用程序时,它失败了,因为"NoCacheRegionFactoryAvailableException“。我已经检查了目录“src/test/ application.yml /config”中的资源,并确保禁用了第二个缓存。我不知道为什么应用程序还在寻找二级缓存。有线索知道这是怎么发生的吗?或者如何完全禁用二级缓存?
除了测试失败之外,其他一切都运行得很好,应用程序可以成功运行。
src/ application.yml /resources/config中的资源
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发布于 2016-11-04 09:54:18
将src/test/resources/config/application.yml移至src/test/resources目录。
您可以在https://github.com/jhipster/generator-jhipster/issues/3730中找到该解决方案
https://stackoverflow.com/questions/37925705
复制相似问题