Creating configuration property beans
@EnableConfigurationProperties
, applied anywhere in our application, will cause a bean of the named type, ChatConfigProperties
, to get added to the application context. A configuration property bean is meant to hold various settings that can be configured with optional defaults and can be overridden through various means.
Remember properties like server.port
where we adjusted the default port our Netty web container listened for web requests? All the properties we've seen through this book are all configuration property beans. This annotation simply gives us the means to define our own property settings specific to our application.
In this case, ChatConfigProperties
is aimed at configuring the WebSocket broker.
Note
It's not critical that the annotation be applied to this specific class. It's just convenient since it's the place where we intend to use it.
Despite enabling such property settings, we still have to inject the bean into our CloudBasedWebSocketConfig...