Solution of redisconnection factory in springboot2 not Autowired

1. No redis package imported, then import the following jar package to solve

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

2. Do the project separation, so pay attention to the @component scanning scope of the Application startup class, default scanning of the Application startup class package and the beans under the subpackage.
is redis – common such as A project, A project of the package name is com.zhangsan.com mon. Redis. B project imports the JAR package of A project, the package name of B project is com. Zhangsan.service.B, then the Application start-up class of B project should be placed under com. Zhangsan, so as to load the beans of A project into A project.

 

Read More: