user1750751
user1750751

Reputation: 275

spring.jpa.properties.hibernate.javax.cache.uri property set with Jetty server

I have an error in a spring-boot + jetty app when trying to set spring.jpa.properties.hibernate.javax.cache.uri property value at application.properties file.

When I do:

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

The error is:

Caused by: java.lang.IllegalStateException: Cache provider not started ... Caused by: javax.cache.CacheException: java.net.MalformedURLException: unknown protocol: classpath

Otherwise, if I use a tomcat server as dependency everything works fine.

How can I set the property value in a right way using jetty?

Upvotes: 1

Views: 1381

Answers (1)

user1750751
user1750751

Reputation: 275

I've found a solution using SpEL:

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

Upvotes: 3

Related Questions