Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rupert-madden-abbott/68d1fb7f99ada70d21c26f7867f2376d to your computer and use it in GitHub Desktop.
Save rupert-madden-abbott/68d1fb7f99ada70d21c26f7867f2376d to your computer and use it in GitHub Desktop.
meaningful.prefix.username=whatever
meaningful.prefix.password=ENC(whatever)
@ConfigurationProperties (prefix = "meaningful.prefix")
@Validated
public class MeaningfulClassNameHereProperties {
/**
* The username to access meaningfulServiceNameHerePlease.
*/
@NotBlank
private String username;
/**
* The password to access meaningfulServiceNameHerePlease.
*/
@NotBlank
private String password;
//Getters and Setters here
}
@Named
public class MyCoolService {
private final MeaningfulClassNameHereProperties properties;
public MyCoolService(MeaningfulClassNameHereProperties properties) {
this.properties = properties;
}
}
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment