Use yml in java spring boot to map map cannot be fetched through Environment environment

yml is described as follows

application:
   address:
    "0xb7716e1f5690a841d698dd64ae13727bf719b2cd": "4"
    "0x0f020200ad0729f19be98ddb26685d80359428b7": "5"

by injecting

into the springboot project
  import org.springframework.core.env.Environment;
  @Autowired
  Environment environment;


 Map<String,String> maps = environment.getProperty("application.address",Map.class);

it is fetched through environment in the method. If it returns null, what should I do?

Mar.19,2021

answer your own questions

in this case, you can only use @ ConfigurationProperties ("application") to fetch
and configure a member variable to receive

.
Menu