I am trying to read value from application properties into a class annotated with
@Configuration
public class testClass {
@Value("${com.x.y.z.dummy.name}")
private String name;
once I run the code at a method in this class annotated with @Bean:
@Bean
public Helper helper(X x){
System.out.println(this.name);
}
Here the output is -> ${com.x.y.z.dummy.name}
instead of the value of ${com.x.y.z.dummy.name}
in the application.properties . I tried @Autowired
and tried reading from environment variable too. Not sure what might be happening. Could anyone help with this?
Adding application.properties:
com.x.y.z.dummy.name=localhost
com.x.y.z.dummy.host=8888