Created
March 29, 2017 07:42
-
-
Save liviutudor/0659829dcc3584ca25a33d9bb5e5be10 to your computer and use it in GitHub Desktop.
Right way of using Governator's @configuration annotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClass { | |
@Configuration("path.prefix") | |
private String pathPrefix; | |
private String fileName; | |
public MyClass(String fileName) { | |
this.fileName = fileName; //here we simply store it | |
} | |
@PostConstruct | |
void initialize() { | |
fileName = pathPrefix + fileName; //and here we use the configuration setting and create the full path | |
} | |
//... rest of the work goes here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment