引用:https://blog.csdn.net/qq_17586821/article/details/79802320 spring boot允许我们把配置信息外部化.由此,我们就可以在不同的环境中使用同一套程序代码.可以使用属性文件,yaml文件,环境变量,命令行参数来实现配置信息的外部化.可以使用@Value注解来将属性值直接注入到bean里边.也可以使用@ConfigurationProperties注解将属性值注入到结构化的对象里边. @ConfigurationProperties
这周在项目中遇到这样一个Bug,代码大致是这样的,有一个LogEntity日志类,里面有一个InnerLog负责存储每次请求的RPCInfo相关信息, 每次请求的时候会把RPC相关信息加入到InnerLog中. public class LogEntity { public LogEntity() { } private InnerLog inner = new InnerLog(); public void addRpcInfo(RpcInfo rpcInfo) { if (gene == n
一.注解方式 编写实体类: package com.example.bean; import org.springframework.boot.context.properties.ConfigurationProperties; /** * Created by Loser100 on 2017/10/9. */ @Component @ConfigurationProperties(prefix = "hello") public class HelloServicePropert