application.properties file has:
my.greeting = Hello
ServiceClass file has:
@Value("${my.greeting}")
private String messageFromProperties;
MainAppfile:
public static void main(String[] args) {
SpringApplication.run(SpringBootApplicationConceptsApplication.class, args);
ServiceClass serv = new ServiceClass();`enter code here`
System.out.println(serv.getMessageFromProperties());//getting null
}
Please let me know what am i missing here. What all configuration is pending