@Test public void testFlowMap() { HashMap<Object, Object> map = new HashMap<>(); when(this.jsfBeansAutoConfiguration.flowScope()).thenReturn(map); Object bean = new Object() { @Autowired @FlowMap private Map<String, Object> map; }; this.jsfBeansAnnotationPostProcessor.postProcessBeforeInitialization(bean, ""); verify(this.jsfBeansAutoConfiguration).flowScope(); assertThat(bean).hasFieldOrPropertyWithValue("map", map); }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), field -> this.suppliers.forEach((annotation, supplier) -> { if (AnnotatedElementUtils.hasAnnotation(field, annotation)) { ReflectionUtils.makeAccessible(field); ReflectionUtils.setField(field, bean, supplier.get()); } }), this::isAutowiredField); return bean; }
JsfBeansAnnotationPostProcessor implements BeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), field -> this.suppliers.forEach((annotation, supplier) -> { if (AnnotatedElementUtils.hasAnnotation(field, annotation)) { ReflectionUtils.makeAccessible(field); ReflectionUtils.setField(field, bean, supplier.get()); } }), this::isAutowiredField); return bean; } }
JsfBeansAnnotationPostProcessor implements BeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), field -> this.suppliers.forEach((annotation, supplier) -> { if (AnnotatedElementUtils.hasAnnotation(field, annotation)) { ReflectionUtils.makeAccessible(field); ReflectionUtils.setField(field, bean, supplier.get()); } }), this::isAutowiredField); return bean; } JsfBeansAnnotationPostProcessor(JsfBeansAutoConfiguration jsfBeansAutoConfiguration); }
JsfBeansAnnotationPostProcessor implements BeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), field -> this.suppliers.forEach((annotation, supplier) -> { if (AnnotatedElementUtils.hasAnnotation(field, annotation)) { ReflectionUtils.makeAccessible(field); ReflectionUtils.setField(field, bean, supplier.get()); } }), this::isAutowiredField); return bean; } JsfBeansAnnotationPostProcessor(JsfBeansAutoConfiguration jsfBeansAutoConfiguration); @Override Object postProcessBeforeInitialization(Object bean, String beanName); }
JsfBeansAnnotationPostProcessor implements BeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), field -> this.suppliers.forEach((annotation, supplier) -> { if (AnnotatedElementUtils.hasAnnotation(field, annotation)) { ReflectionUtils.makeAccessible(field); ReflectionUtils.setField(field, bean, supplier.get()); } }), this::isAutowiredField); return bean; } JsfBeansAnnotationPostProcessor(JsfBeansAutoConfiguration jsfBeansAutoConfiguration); @Override Object postProcessBeforeInitialization(Object bean, String beanName);  }