@Component 
@ConfigurationProperties(prefix = "aa")
@Getter
@Setter
public class Utils {

private String username;
private String password;


private static Utils A_UTILS=new Utils ();

@Autowired
public void init(FtpUtils utils){
    Utils.A_UTILS=utils;
    }
}

注入bean

yml 文件里

aa.username=zhangshan
aa.password=123456

注入成功了

相关文章:

  • 2021-04-29
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-02-09
  • 2021-05-31
  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2021-05-12
  • 2021-04-16
  • 2021-12-28
  • 2021-07-25
  • 2021-06-26
  • 2021-09-28
相关资源
相似解决方案