Spring boot fails to start with Cache [product.result] specifies key/value types. Use getCache(String, Class, Class)

I need to cache the result for a few DB calls since it takes a very long time. I am trying to use EhCache. I am using Spring boot.

Below is my Repository class (which is in a separate module then my service class and RestController)

@Cacheable(value = "product.result", key="#term")
    public List<StoreProduct> getTopProductsForTerm(String term, int offset, int maxCount) {
        String query = GET_TOP_STORE_CATEGORY;
        Query nativeQuery = this.entityManager.createNativeQuery(query);
        nativeQuery.setParameter(1, maxCount);
        nativeQuery.setParameter(2, offset);
        nativeQuery.setParameter(3, term);
        return nativeQuery.getResultList();
    }

Below is my ehcache.xml

<config
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns='http://www.ehcache.org/v3'
        xsi:schemaLocation="
            http://www.ehcache.org/v3
            http://www.ehcache.org/schema/ehcache-core-3.7.xsd">
    <!-- Persistent cache directory -->
    <persistence directory="spring-boot-ehcache/cache" />
    <!-- Default cache template -->
    <cache-template name="default">
        <expiry>
            <ttl unit="seconds">604800</ttl>
        </expiry>
        <listeners>
            <listener>
                <class>com.pixyfi.data.logger.CacheLogger</class>
                <event-firing-mode>ASYNCHRONOUS</event-firing-mode>
                <event-ordering-mode>UNORDERED</event-ordering-mode>
                <events-to-fire-on>CREATED</events-to-fire-on>
                <events-to-fire-on>EXPIRED</events-to-fire-on>
                <events-to-fire-on>EVICTED</events-to-fire-on>
            </listener>
        </listeners>
        <resources>
            <heap>1000</heap>
            <offheap unit="MB">10</offheap>
            <disk persistent="true" unit="MB">20</disk>
        </resources>
    </cache-template>
    <cache alias="product.result" uses-template="default">
        <key-type>java.lang.String</key-type>
        <value-type>java.util.ArrayList</value-type>
    </cache>
</config>

There was one answer on stackoverflow that suggest since we are using Spring, so we are no longer in control to define key type and value type. but when I remove these entry from ehcache.xml, I get another exception stating Keytype

Persisted key type 'java.lang.String' is not the same as the

If I define keytype only then it fails for value type with same exception If I specify both then it fails with exception

Cache [product.result] specifies key/value types. Use getCache(String, Class, Class)

I tried to use KeyGenerator as well but that also fails with same key-type mismatch. I followed this post https://dimitr.im/spring-boot-cache-ehcache to setup caching but it doesn't seems to work

I guess (and i am probably wrong) that there's cache manager specifically provided by Spring which is not activated

Below are dependencies that I used In module containing rest API (also tried defining in data module) org.springframework.boot spring-boot-starter-cache

In data module

<dependency>
            <groupId>javax.cache</groupId>
            <artifactId>cache-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ehcache</groupId>
            <artifactId>ehcache</artifactId>
        </dependency>

Is there anything I am missing?