简体   繁体   中英

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 binded. Any thoughts to get the binding going?

您需要启用配置属性。

@EnableConfigurationProperties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM