Monday, February 1, 2021

Spring Boot - ConfigurationProperties

Works in SpringBoot Only

Check Following properties file 

#Simple properties
mail.hostname=host@mail.com
mail.port=9000
mail.from=mailer@mail.com

Properties file directly mapped to Class Fields


Use @ConfigurationProperties 

@ConfigurationProperties(prefix = "mail") 
public class ConfigProperties { 

    private String hostName; 
    private int port; 
    private String from; 

    // standard getters and setters 
}

org.springframework.boot.context.properties.ConfigurationProperties;

No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass