I have a properties file that I want to load the contents into a hashmap, is this possible?
styles.properties
email.style.body=background: red; font-family: 'Helvetica', 'Arial', sans-serif; font-size: 12px; font-weight: 400; margin: 0 auto; padding: 0; line-height:22px
email.style.box=border-radius: 5px; background: #FFF; padding: 15px 20px 18px 20px; box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
email.style.box.half=max-width: 360px;
email.style.box.title=font-family: Helvetica, Arial, sans-serif; font-weight: 700; font-style: normal; font-size: 12px; text-align: left; text-transform: uppercase; margin: 0 0 10px 0;
email.style.box.content=font-family: Helvetica, Arial, sans-serif; font-weight: 400; font-size: 13px; min-height: 150px !important; position: relative;
email.style.box.content.p=margin-block-start: 0; margin-block-end: 0;
email.style.box.content.attachments=width: 100%; position: absolute; bottom: 10px;
Currently, I am getting each value via @Value
annotation, I am thinking if it is possible to get all these properties and put into a hashmap.
This way, I can just call map.get("email.style.box.content.attachments")
to get a specific value
There is a possibility the this styles.properties
will get big.
Manually, I can read the file... read each line and then split the key and value and store in hashmap.
This is possible but I think the practice is not good. Is there a better way to do this? Or what is the best approach to put all these properties into a hashmap?
TIA