Ver código fonte

增加配置文件读取

tags/v1.0.0^2
林万龙 4 anos atrás
pai
commit
4e7b6e5f34
2 arquivos alterados com 29 adições e 0 exclusões
  1. +19
    -0
      src/main/java/com/telpo/dipperposition/co/RzlAccount.java
  2. +10
    -0
      src/main/java/com/telpo/dipperposition/config/PositionConfig.java

+ 19
- 0
src/main/java/com/telpo/dipperposition/co/RzlAccount.java Ver arquivo

@@ -0,0 +1,19 @@
package com.telpo.dipperposition.co;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
* @program: RzlAccount
* @description: 融智联账号配置
* @author: king
* @create: 2021-01-12 14:02
**/
@Getter
@Setter
@ToString
public class RzlAccount {

private String hello;
}

+ 10
- 0
src/main/java/com/telpo/dipperposition/config/PositionConfig.java Ver arquivo

@@ -3,12 +3,14 @@ package com.telpo.dipperposition.config;
import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.config.ConfigService;
import com.telpo.dipperposition.co.RzlAccount;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.util.Properties;

@@ -28,4 +30,12 @@ public class PositionConfig {
@Value("${hello}")
private String hello;

@Scope("prototype")
public RzlAccount getRzlAccount() {

RzlAccount rzlAccount = new RzlAccount();
rzlAccount.setHello(hello);
return rzlAccount;
}

}

Carregando…
Cancelar
Salvar