Skip to content

Category: Spring Boot

How to programmatically add and remove elements from Ehcache

Pre-requisites This guide assumes that you have already configured Ehcache, and is specifically concerned with programmatic addition and removal of elements. Adding an element to a cache @Autowired private CacheManager cacheManager; […] public Ehcache getCache(String name) { return cacheManager.getCache(name); } In the above example we…

Continue reading How to programmatically add and remove elements from Ehcache

How to implement custom queries using Spring-data and JPA

This tutorial will describe how to implement custom JPA methods for dynamically-driven queries in Spring Boot. Maven package dependencies <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.1.RELEASE</version> <relativePath /> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> </dependencies> The JPA interface Typically JPA…

Continue reading How to implement custom queries using Spring-data and JPA