← Back to list

Reading Configuration Value in Spring Boot

This is my personal notes for my spring boot leaning journey. Please feel free to discuss.

Pyae Sone · 2022-06-27 10:51 · 106 claps · 0.5 min read
#spring-boot #spring
Open on Medium ↗
Wiki topics: 📚 · Books & Reading

Reading Configuration Value in Spring Boot

This is my personal notes for my spring boot leaning journey. Please feel free to discuss.

There is two ways to read configuration in spring boot.

  1. Reading as Config Map

Configuration will be defined in application.properties file.

[embed]

It will be read with a class. The class can also be used as bean class.

[embed]

Read via as bean

@Autowired
private AgentIdMapConfig agentIdMapConfig;
// To read into vars
Long agentId = agentIdMapConfig.getAgentIdMap().get(client);
  1. Reading directly as config value

[embed]


메타데이터
post_id
43a74e7ef8ba
slug
reading-configuration-value-in-spring-boot-43a74e7ef8ba
url
https://medium.com/@pyaesone/reading-configuration-value-in-spring-boot-43a74e7ef8ba
canonical_url
https://medium.com/@pyaesone/reading-configuration-value-in-spring-boot-43a74e7ef8ba
author_url
https://medium.com/@pyaesone
status
ok
fetched_at
2026-07-26 23:00:14