@EnableConfigurationProperties: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 6: Line 6:


Can be used to register classes that are not components, yet still want to take advantage of [[@ConfigurationProperties]] mechanism. If a regular component is annotated with [[@ConfigurationProperties]], it does not need help from @EnableConfigurationProperties.
Can be used to register classes that are not components, yet still want to take advantage of [[@ConfigurationProperties]] mechanism. If a regular component is annotated with [[@ConfigurationProperties]], it does not need help from @EnableConfigurationProperties.
=Example=
<syntaxhighlight lang='java'>
@EnableConfigurationProperties(MyConfig.class)
@ConfigurationProperties(prefix = "com.example.my.config")
public class MyConfig {
  ...
}
</syntaxhighlight>

Latest revision as of 22:01, 21 January 2019

Internal

Overview

Can be used to register classes that are not components, yet still want to take advantage of @ConfigurationProperties mechanism. If a regular component is annotated with @ConfigurationProperties, it does not need help from @EnableConfigurationProperties.

Example

@EnableConfigurationProperties(MyConfig.class)
@ConfigurationProperties(prefix = "com.example.my.config")
public class MyConfig {

   ...
}