ConfigurationProperties
2019独角兽企业重金招聘Python工程师标准>>>
package cn.enjoy.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "spring.datasource.spring")
@Component
public class DBConfig1 {
private String driverClassName;
private String jdbcUrl;
private String username;
private String password;
public String getDriverClassName() {
return driverClassName;
}
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
public String getJdbcUrl() {
return jdbcUrl;
}
public void setJdbcUrl(String jdbcUrl) {
this.jdbcUrl = jdbcUrl;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
转载于:https://my.oschina.net/u/2351011/blog/3054158
ConfigurationProperties相关推荐
- Spring Boot @ConfigurationProperties使用指导
1.简介 Spring Boot的一个非常有用的功能是外部化配置,并且可以轻松访问属性文件中定义的属性. 我们现在将详细地探索@ConfigurationProperties注释. 2.设置 本文使用 ...
- Spring Boot 关于 @EnableConfigurationProperties 注解 —— 使用 @ConfigurationProperties 注解的类生效。
先说作用: @EnableConfigurationProperties注解的作用是:使用 @ConfigurationProperties 注解的类生效. 说明: 如果一个配置类只配置@Config ...
- Spring boot 注解 ConfigurationProperties 的使用
原创自 第一勺金 00 最近在学习使用 spring boot.发现其中 @ConfigurationProperties这个注解使用的比较多.搜了比较多的文档都是英文,避免以后忘记,这里我也总结下它 ...
- 在Spring Boot中使用 @ConfigurationProperties 注解 (二十六)
@ConfigurationProperties主要作用:就是绑定application.properties中的属性 java代码 @Configuration public class DataS ...
- @ConfigurationProperties和@Value 注入
我这里使用的Spring Boot 2.0.1 版本 配置文件是 yml 格式文件 @ConfigurationProperties 在yml配置文件中: 在实体类中: 重点是实体类上的两个注解: @ ...
- springboot之@ConfigurationProperties加载配置文件
person.properties文件中 person.age=12 person.boss=false person.last-name="张三" person.maps.k1= ...
- yml语法规则 (5.spring boot配置文件注入@ConfigurationProperties)、配置文件处理器...
applicationi.properties application.yml 以数据为中心,比json xml更适合做配置文件 k: v 表示一对键值对 空格缩进控制层级关系,左对齐的一列数据都 ...
- springboot @ConfigurationProperties
Spring Boot 提供了一种方式 --类型安全的bean,能够根据类型校验和管理application中的bean. 继续使用author做例子.配置放在author.properties文件中 ...
- @Value获取值和@ConfigurationProperties获取值比较||配置文件注入值数据校验
@Value获取值和@ConfigurationProperties获取值比较 配置文件yml还是properties他们都能获取到值: 如果说,我们只是在某个业务逻辑中需要获取一下配置文件中的某项值 ...
最新文章
- python绘制散点图-Python:matplotlib绘制散点图
- 青少年蓝桥杯_2020_steam考试_中级组_第一题
- python3.6使用chardet模块总是报错ValueError: Expected a bytes object, not a unicode object
- Google视角的地理信息科学家
- Consul etcd ZooKeeper euerka 对比
- commons-lang3工具类学习(二)
- mysql索引过多为什么会慢_mysql – 为什么索引使这个查询更慢?
- uniapp ios时间戳获取不到_uni-app打包编译成安卓及ios包并上传发布测试版
- Linux开机报write same failed manually zeroing错误
- Linux下与github建立ssh连接
- Aiseesoft Data Recovery for mac(专业数据恢复软件)
- 禁止浏览器缓存input值
- 摩托罗拉gp3688说明书_摩托罗拉GP3688对讲机充电器电路原理分析
- uart协议学习,从了解到入门,看这篇文章
- SEO与SEM有什么区别?
- Python问题解决6:使用jupyter notebook时安装第三方库提示升级pip,pip升级不成功一直报错
- XMAN misc writeup
- 漫画:鉴权与安全访问控制的技术血脉
- C# 串口接收含有asic2=0x3f时发生的故障
- 2018工业互联网峰会在京召开