Problems in the use of spring boot redis

clipboard.png
the database index is configured in application.properties, but it is useless. It has been added to db0 by default. What is the cause of this?


in theory, it's OK to write this way, to see if you didn't compile the configuration file when compiling.


configuration file does not take effect. When, spring boot loads Redis, if no external configuration is detected, it will automatically be equipped with local localhost:6379 Redis,. You can see the source code. If the introduction of Redis starter, still doesn't work, manually write bean and inject it into the spring container, adding @ primary annotation just to be on the safe side

Menu