Reading values from application.properties Spring Boot

后端 未结 10 1692
无人及你
无人及你 2021-01-18 10:46

My Spring boot app has this application structure:

  • src
    • main
      • java
      • resources
        • application.properties
      <
10条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-18 11:29

    Missing stereotype annotation on top of class

    @Component
    public class EntityManager {
    
        @Value("${language}")
        private static String newLang;
    
        public EntityManager(){
            System.out.println("langauge is: " + newLang);
        }
    }
    

提交回复
热议问题