user871611
user871611

Reputation: 3462

Working with @ConfigurationProperties in a non Spring-Boot application

I'm trying to get configuration-binding in my Spring-MVC application (non Spring-Boot) enabled using the @ConfigurationProperties. The only thing i did so far, is that I added the Maven spring-boot dependency to my project, to get the ConfigurationProperties class.

@Configuration
@PropertySource("classpath:foo.properties")
@ConfigurationProperties(prefix = "foo")
public class FooConfig{

  private String bar;
  // ...  
}

So far nothing is being bound. Any thoughts to get the binding going?

Upvotes: 4

Views: 4197

Answers (1)

pvpkiran
pvpkiran

Reputation: 27078

You need to Enable Configuration Properties.

@EnableConfigurationProperties

Upvotes: 4

Related Questions