Home>

I don't know how to get property file values ​​other than controller class and test class in Spring Boot.
I tried to get it in another class, just like the way I got it in the controller class.
NullPointerException will occur.

Is it possible to get property file values ​​only from the controller class?

Thank you.


Referenced sites

  • Answer # 1

    I answer very roughly.

    Annotation of Spring management class such as @Component to an appropriate class,
    @Value ("${hogehoge}");
    I think that I could read by doing.

    I'm sorry if the format is a little wrong.