I have situation, where I want to read configuration file only one time, when class is instantiated.
Suppose I have a method named readConfig()
, that reads configuration and puts it into a Map
object. When the program is required to use configuration value it reads object with it's define key. I want to know that constructor calls only once it's life cycle. Can I put my method readConfig()
into constructor, which would give me benefit of one time calling or is there another mechanism to do that?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…