DEV Community 👩‍💻👨‍💻

Discussion on: Spring @Value annotation tricks

Collapse
 
habeebcycle profile image
Habeeb Okunade Author

Yes, through construtor injection.
For instance,

private final Path filePath;
public PathConfig(@Value("${name-to-your-path}") String pathStr) {
this.filePath = Paths.get(pathStr).toAbsolutePath().normalize();
}