jeudi 27 juin 2019

Constants in Properties File

My team is new to Spring Boot and most members were previously working on a J2EE legacy application. I have previous experience with Spring Boot and microservices. My question is about a pattern they are using that I've never seen before and want to understand why this may or may not be a good idea.

They have been creating several properties files and adding key value pairs to these property files which get injected into object fields using @Value or ResourceBundle.

For example something I would normally think of as an Enum like color will be added to a property file, the same with constants.

#color.properties
color.r = red
color.b = blue
color.g = green

It seems like a lot of unnecessary code is getting written, like injecting all the values into a class then creating an array with the values in them. We are also battling to get this working.

I thought the point of the properties file was for externalized config. Why is my team doing this when Java provides data types and structures for these things?

Aucun commentaire:

Enregistrer un commentaire