Skip to content

Instantly share code, notes, and snippets.

@liviutudor
Created March 29, 2017 07:42
Show Gist options
  • Save liviutudor/0659829dcc3584ca25a33d9bb5e5be10 to your computer and use it in GitHub Desktop.
Save liviutudor/0659829dcc3584ca25a33d9bb5e5be10 to your computer and use it in GitHub Desktop.
Right way of using Governator's @configuration annotation
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