Finished Spring Data repository scanning in 191 ms. Found 0 Redis repository interfaces
354浏览 · 2024-02-01 16:13:55
This message typically appears when using [spring](https://wenku.csdn.net/doc/6412b53cbe7fbd1778d426e5?spm=1055.2569.3001.10083) Data [redis](https://wenku.csdn.net/doc/6401ac7acce7214c316ec002?spm=1055.2569.3001.10083) and no Redis repositories have been defined in the application. Spring Data Redis provides [support](https://wenku.csdn.net/doc/6v5a8g2o7w?spm=1055.2569.3001.10083) for Redis repositories, which are interfaces that define methods for performing CRUD operations on Redis keys and their values.
To define a Redis [repository](https://wenku.csdn.net/doc/646c306c543f844488cfbfa2?spm=1055.2569.3001.10083) interface, you can create a new interface that extends the `org.spring[framework](https://wenku.csdn.net/doc/1cwfjxgacp?spm=1055.2569.3001.10083).data.keyvalue.repository.KeyValueRepository` interface, and provide the type of the key and value as generic parameters. For example:
```java
public interface MyRedisRepository extends KeyValueRepository<MyEntity, String> {
// custom methods can be defined here