Merge branch '2.2.x' into 2.3.x
Closes gh-24009
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.boot.jdbc;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public abstract class AbstractDataSourceInitializer {
|
||||
public abstract class AbstractDataSourceInitializer implements InitializingBean {
|
||||
|
||||
private static final String PLATFORM_PLACEHOLDER = "@@platform@@";
|
||||
|
||||
@@ -50,7 +50,11 @@ public abstract class AbstractDataSourceInitializer {
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
protected void initialize() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user