Class ObfuscatedSupportBeanFactoryPostProcessor
java.lang.Object
com.github.robtimus.obfuscation.spring.ObfuscatedSupportBeanFactoryPostProcessor
- All Implemented Interfaces:
BeanFactoryPostProcessor
public class ObfuscatedSupportBeanFactoryPostProcessor
extends Object
implements BeanFactoryPostProcessor
A
BeanFactoryPostProcessor that adds support for autowiring Obfuscated instances.
If an instance of this class is activated, it will allow instances of Obfuscated to be autowired.
This autowiring consists of three steps:
- Finding the value to obfuscate. This is done using the default mechanisms. A field, constructor argument or method argument can be annotated
with
Value, it can be a bean, or anything else that has default autowiring support. - Finding the obfuscator to use. The type of
Obfuscatoris determined as follows:- If the
Obfuscatedfield, constructor argument or method argument is annotated with anObfuscatorannotation likeObfuscateAll,ObfuscateFixedLengthorObfuscateUsing, the autowiredObfuscatedwill match the annotation. - Otherwise, if a bean of type
Obfuscatoris available, that will be autowired. - Otherwise, a default
Obfuscatorwill be autowired. This will be the result of callingObfuscator.fixedLength(3).
- If the
- Finding the character representation to use. This is done by annotating the field, constructor argument or method argument with
RepresentedBy. If this annotation is absent, thedefault character representationis used.
The Obfuscator and character representation are used to wrap the value to obfuscate in an Obfuscated instance, which will then be
autowired.
- Author:
- Rob Spoor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidpostProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
-
Constructor Details
-
ObfuscatedSupportBeanFactoryPostProcessor
public ObfuscatedSupportBeanFactoryPostProcessor()
-
-
Method Details
-
postProcessBeanFactory
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException - Specified by:
postProcessBeanFactoryin interfaceBeanFactoryPostProcessor- Throws:
BeansException
-