All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.zonky.test.db.flyway.FlywayPropertiesPostProcessor Maven / Gradle / Ivy

Go to download

A library for creating isolated embedded databases for Spring-powered integration tests.

The newest version!
package io.zonky.test.db.flyway;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.flyway.FlywayProperties;
import org.springframework.core.Ordered;

public class FlywayPropertiesPostProcessor implements BeanPostProcessor, Ordered {

    @Override
    public int getOrder() {
        return Ordered.LOWEST_PRECEDENCE - 1;
    }

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof FlywayProperties) {
            FlywayProperties properties = (FlywayProperties) bean;
            properties.setUrl(null);
            properties.setUser(null);
            properties.setPassword(null);
        }
        return bean;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy