Could not safely identify store assignment for repository

problem description

Environment: spring boot 2.0.4
java: 1.8
mysql and redis are used in the project

console output

@EnableJpaRepositories(basePackages = "com.acme.repositories.jpa")
@EnableMongoRepositories(basePackages = "com.acme.repositories.mongo")
interface Configuration { }

but still not good

Dec.17,2021

disable repositories of redis directly

spring.data.redis.repositories.enabled = false

this is a good thing done by Spring Boot's Autoconfigure package. There is a class called RedisRepositoriesAutoConfiguration that checks whether there is Jedis and @ EnableRedisRepositories, in the current classpath. If it exists, it will automatically enable this annotation for you (without parameters), regardless of whether your code is useful or not, so the entire classpath class will be swept in.

the solution is also very simple. RedisRepositoriesAutoConfiguration will determine whether the configuration item spring.data.redis.repositories.enable exists. If it does not exist, it will take effect if it does not exist, if it exists or if the value is true, as long as it is explicitly set to false. If you do not want to write configuration information and do not need to use RedisRepository (it does not affect that RedisTemplate), can deal with it by checking whether the Bean of RedisRepositoryFactoryBean exists. If it does not exist, then execute the AutoConfiguration, as long as you create a RedisRepositoryFactoryBean in the code, for example,

).
@Bean
public RedisRepositoryFactoryBean redisRepositoryFactoryBean() {
    return null;
}

if this Bean exists (though it is null), it will not be executed


how do you write your repository?
is there an annotation? with @ Repository
did you add Redis's bag?
have you matched the relevant configurations of Redis?


have you solved it yet? I think this official document says that if you use jpa or mongo-specific comments, you can solve this problem. Although it doesn't affect it, it looks uncomfortable

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b87e-2c299.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b87e-2c299.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?