samedi 7 mars 2015

How to read Spring Boot application.properties?

I've just read documentation about external config and I found I can easily access application.properties using:



@Component
public class MyBean {

@Value("${name}")
private String name;

// ...

}


But I want to add property to the class, that is not Spring component (I initialize it using new).


Is there any way to access it in a simple way, that I don't have to use the container?


Aucun commentaire:

Enregistrer un commentaire