|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -20,8 +20,6 @@ import java.lang.reflect.Modifier;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.function.BiConsumer;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
|
|
|
import com.fasterxml.jackson.databind.KeyDeserializer;
|
|
|
|
@ -33,6 +31,7 @@ import org.springframework.beans.BeansException;
|
|
|
|
|
import org.springframework.beans.factory.BeanFactory;
|
|
|
|
|
import org.springframework.beans.factory.BeanFactoryAware;
|
|
|
|
|
import org.springframework.beans.factory.HierarchicalBeanFactory;
|
|
|
|
|
import org.springframework.beans.factory.InitializingBean;
|
|
|
|
|
import org.springframework.beans.factory.ListableBeanFactory;
|
|
|
|
|
import org.springframework.boot.jackson.JsonComponent.Scope;
|
|
|
|
|
import org.springframework.core.ResolvableType;
|
|
|
|
@ -51,7 +50,7 @@ import org.springframework.util.ObjectUtils;
|
|
|
|
|
* @since 1.4.0
|
|
|
|
|
* @see JsonComponent
|
|
|
|
|
*/
|
|
|
|
|
public class JsonComponentModule extends SimpleModule implements BeanFactoryAware {
|
|
|
|
|
public class JsonComponentModule extends SimpleModule implements BeanFactoryAware, InitializingBean {
|
|
|
|
|
|
|
|
|
|
private BeanFactory beanFactory;
|
|
|
|
|
|
|
|
|
@ -60,7 +59,11 @@ public class JsonComponentModule extends SimpleModule implements BeanFactoryAwar
|
|
|
|
|
this.beanFactory = beanFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
|
@Override
|
|
|
|
|
public void afterPropertiesSet() {
|
|
|
|
|
registerJsonComponents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void registerJsonComponents() {
|
|
|
|
|
BeanFactory beanFactory = this.beanFactory;
|
|
|
|
|
while (beanFactory != null) {
|
|
|
|
|