Obfuscators
The properties described in Properties can be reused with a different prefix to auto-configure other obfuscators with the following steps:
- Expose a bean of type ObfuscatorProperties.
Make sure it's annotated with @ConfigurationProperties with a unique prefix.
Spring Boot should ensure that the
ObfuscatorPropertiesobject is validated. - Provide an AutowireCapableBeanFactory.
- Call createObfuscator on the
ObfuscatorPropertiesinstance to create an obfuscator. - Use a subclass of ObfuscatorPropertiesCondition in combination with @Conditional to only auto-configure the obfuscator conditionally.
For an example, see ObfuscatorAutoConfiguration.java.
Nesting obfuscators
It's possible to nest ObfuscatorProperties in another auto-configuration properties class. Make sure that the root properties class of the structure containing the ObfuscatorProperties instances is annotated with @Validated.
This will ensure that the ObfuscatorProperties instances are in a consistent state.
