You are currently viewing How To Load Ehcache.xml From External Location Spring Boot? – Quick & Easy Solution In 2 Mins!
Photo by Nick Morrison on Unsplash
Could You Please Share This Post? I Appreciate It And Thank YOU! :) Have A Nice Day!
4.8
(1280)

In this tutorial we will focus on how to load ehCache.xml from external location Spring Boot. Out of the box the ehCache is looking for the ehCache.xml configuration file in resources path which is packed into jar file. In case when you want to use external ehCache.xml configuration file to can use the VM options and pass there appropriate value.

What is Spring Boot?

Pivotal maintains the Spring Boot micro framework as an open-source project. It provides a framework for Java developers to get started with a production-grade Spring application that is auto customizable. It allows developers to get up and running quickly without having to waste time planning and configuring their Spring application.

This article will walk you through the basics of Spring Boot and how to use it.

But, before we get started, let’s have a look at the underlying tool: Spring. Why? To establish a constructive assessment about Spring Boot, you must first understand Spring.

What is Ehcache?

Ehcache is an open source, standards-based cache that boosts performance, offloads your database, and simplifies scalability. It’s the most widely-used Java-based cache because it’s robust, proven, full-featured, and integrates with other popular libraries and frameworks. Ehcache scales from in-process caching, all the way to mixed in-process/out-of-process deployments with terabyte-sized caches.

Load ehcache.xml from external location Spring Boot

The most important part is the “file:” prefix before the path. Without it the application will looking for the configuration file in the classpath.

-Dspring.cache.jcache.config=file:<external_location>

Ehcache Spring Boot Configuration

Use the EhCache Spring Boot below exmple:

-Dspring.cache.jcache.config=file:/spring-boot-apps/my-app/conf/ehcache.xml

Ehcache 3.10 is now available!

The major feature in this release is addition of new variant JARs that adopt the Jakarta EE namespaced JTA and JAXB APIs.

It requires Java 8+.

Watch for continued rapid improvements to features, stability and performance of the 3.x line throughout the coming months!As a reminder, Ehcache 3 introduced the following:

  • Revamped API that leverages Java generics and simplifies Cache interactions,
  • Full compatibility with javax.cache API (JSR-107),
  • Offheap storage capabilities, including offheap only caches,
  • Out of the box Spring Caching and Hibernate integration thanks to the javax.cache support,
  • And many more …

“Official” builds are available on the project’s GitHub release page or from Maven Central – see below.

Could You Please Share This Post? 
I appreciate It And Thank YOU! :)
Have A Nice Day!

BigData-ETL: image 7YOU MIGHT ALSO LIKE

How useful was this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 1280

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?