Spring boot Jetty server的spring.jpa.properties.hibernate.javax.cache.uri属性集

Spring boot Jetty server的spring.jpa.properties.hibernate.javax.cache.uri属性集,spring-boot,jetty,ehcache,Spring Boot,Jetty,Ehcache,试图在application.properties文件中设置spring.jpa.properties.hibernate.javax.cache.uri属性值时,spring boot+jetty应用程序中出现错误 当我这样做时: spring.jpa.properties.hibernate.javax.cache.uri=classpath:/ehcache.xml 错误是: 原因:java.lang.IllegalStateException:缓存提供程序未启动 ... 原因:javax

试图在application.properties文件中设置spring.jpa.properties.hibernate.javax.cache.uri属性值时,spring boot+jetty应用程序中出现错误

当我这样做时:

spring.jpa.properties.hibernate.javax.cache.uri=classpath:/ehcache.xml

错误是:

原因:java.lang.IllegalStateException:缓存提供程序未启动
...
原因:javax.cache.CacheException:java.net.MalformedURLException:未知协议:类路径

否则,如果我使用tomcat服务器作为依赖项,一切都可以正常工作


如何使用jetty以正确的方式设置属性值?

我找到了使用SpEL的解决方案:

spring.jpa.properties.hibernate.javax.cache.uri=${new org.springframework.core.io.ClassPathResource(“/ehcache.xml”).getURI().toString()}