autoconfiguration.CustomHibernateAutoConfiguration Maven / Gradle / Ivy
package autoconfiguration;
import fi.evolver.ai.spring.hibernate.TableExclusionSchemaFilterProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer;
import org.springframework.context.annotation.Bean;
/**
* This is enabled in
* src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
* Must not be in the component scan paths according to
* Spring Boot docs
*
* Auto-configurations must be loaded only by being named in the imports file. Make sure that they are
* defined in a specific package space and that they are never the target of component scanning. Furthermore,
* auto-configuration classes should not enable component scanning to find additional components. Specific @Import
* annotations should be used instead.
*
*/
@AutoConfiguration
@AutoConfigureAfter(HibernateJpaAutoConfiguration.class)
public class CustomHibernateAutoConfiguration {
@Bean
public HibernatePropertiesCustomizer hibernatePropertiesCustomizer() {
return properties -> {
properties.put("hibernate.hbm2ddl.schema_filter_provider", TableExclusionSchemaFilterProvider.class.getName());
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy