application.yml读取属性值
1、application.yml设置
2、编写配置类
package com.hgchain.neo4j.data.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author bai
*/
@Component
@ConfigurationProperties(prefix = "kettle-repository")
@Data
public class KettleMysqlRepProperties {
private String name;
private String access;
private String type;
private String host;
private String db;
private String user;
private String pass;
private String port;
}
3、使用