当创建完成项目之后,我们怎么能够知道在配置文件中,写入哪些配置。
例如我们创建springboot项目,项目中引入redis。我们的pom文件
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
接下来我们来看我们怎么知道需要配置redis的哪些内容
我们搜索到 springboot 的autoconfigure包
图1
进入spring.factories文件,我们来搜索到redis相关的内容,进入红框类里面
图2
找到Properties注解,后面则为配置项对应的参数类
图3
进入对应的RedisProperties文件,我们即可发现我们需要配置的内容
图4