Avi
Avi

Reputation: 21866

@Value is not injected

I'm trying to inject value from properties file into a spring configuration class as follows:

@Configuration
@EnableWebMvc
public class ImagesContext {
   @Autowired
   @Value("${some.property.com}")
   private String property;

   @Bean
   public MyClass getMyClass() {
      return new MyClass(property);
   }
}

But the property is not injected correctly. Instead, when I debug, I see that the property string contains ${some.property.com} and not the string value itself.

Upvotes: 7

Views: 12687

Answers (0)

Related Questions