springboot 怎么知道配置文件寫哪些內(nèi)容


當(dāng)創(chuàng)建完成項目之后,我們怎么能夠知道在配置文件中,寫入哪些配置。
例如我們創(chuàng)建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的哪些內(nèi)容
我們搜索到 springboot 的autoconfigure包


圖1

進(jìn)入spring.factories文件,我們來搜索到redis相關(guān)的內(nèi)容,進(jìn)入紅框類里面


圖2

找到Properties注解,后面則為配置項對應(yīng)的參數(shù)類
圖3

進(jìn)入對應(yīng)的RedisProperties文件,我們即可發(fā)現(xiàn)我們需要配置的內(nèi)容
圖4
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容