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
Obfuscator
is determined as follows:- If the
Obfuscated
field, constructor argument or method argument is annotated with anObfuscator
annotation likeObfuscateAll
,ObfuscateFixedLength
orObfuscateUsing
, the autowiredObfuscated
will match the annotation. - Otherwise, if a bean of type
Obfuscator
is available, that will be autowired. - Otherwise, a default
Obfuscator
will 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 representation
is 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
postProcessBeanFactory
(ConfigurableListableBeanFactory beanFactory)
-
Constructor Details
-
ObfuscatedSupportBeanFactoryPostProcessor
public ObfuscatedSupportBeanFactoryPostProcessor()
-
-
Method Details
-
postProcessBeanFactory
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException - Specified by:
postProcessBeanFactory
in interfaceBeanFactoryPostProcessor
- Throws:
BeansException
-