博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SpringBoot常用属性配置
阅读量:4685 次
发布时间:2019-06-09

本文共 1361 字,大约阅读时间需要 4 分钟。

SpringBoot 2.x:

 

1、详见:

2、上面文件的另外一个版本:

官方文档上是这么说明这个属性列表的:

注:属性可以来自classpath下的其他jar文件中, 所以你不应该把它当成详尽的列表。 定义你自己的属性也是相当合法的。注:示例文件只是一个指导。 不要拷贝/粘贴整个内容到你的应用, 而是只提取你需要的属性

3、上面这个链接只是列举的部分常用的属性项,完整的配置在:spring-boot-autoconfigure-xxx.jar里的xxx模块下的XXProperties.java里。

完整的列表:

这里拿redis举例:

这个对象里的属性就为可以配置的所有的属性。

摘取上面那个RedisProperties.java文件里的部分代码:

package org.springframework.boot.autoconfigure.data.redis;import java.util.List;import org.springframework.boot.context.properties.ConfigurationProperties;/** * Configuration properties for Redis. * * @author Dave Syer * @author Christoph Strobl * @author Eddú Meléndez * @author Marco Aust */@ConfigurationProperties(prefix = "spring.redis")public class RedisProperties {    /**     * Database index used by the connection factory.     */    private int database = 0;    /**     * Redis url, which will overrule host, port and password if set.     */    private String url;    /**     * Redis server host.     */    private String host = "localhost";    /**     * Login password of the redis server.     */    private String password;    /**     * Redis server port.     */    private int port = 6379;    /**     * Enable SSL.     */    private boolean ssl;    /**     * Connection timeout in milliseconds.     */    private int timeout;        //...........................}

 

转载于:https://www.cnblogs.com/yangzhilong/p/6538195.html

你可能感兴趣的文章
Copy code from eclipse to word, save syntax.
查看>>
arguments.callee的作用及替换方案
查看>>
23 Java学习之RandomAccessFile
查看>>
P2709 小B的询问
查看>>
润乾报表 动态控制文本的显示
查看>>
[oracle] 如何使用myBatis在数据库中插入数据并返回主键
查看>>
PHP echo 和 print 语句
查看>>
第一讲 一个简单的Qt程序分析
查看>>
Centos 6.5下的OPENJDK卸载和SUN的JDK安装、环境变量配置
查看>>
poj 1979 Red and Black(dfs)
查看>>
【.Net基础03】HttpWebRequest模拟浏览器登陆
查看>>
UML-画类图与交互图的顺序
查看>>
6月7 考试系统
查看>>
mysql 基本操作
查看>>
zTree async 动态参数处理
查看>>
Oracle学习之常见错误整理
查看>>
HTC Sensation G14开盒
查看>>
lock_sga引起的ksvcreate :process(m000) creation failed
查看>>
数据库插入数据乱码问题
查看>>
OVER(PARTITION BY)函数用法
查看>>