diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/JdbcRepositoryConfigExtension.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/JdbcRepositoryConfigExtension.java index 795e3fb4f83..cdf87f659be 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/JdbcRepositoryConfigExtension.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/JdbcRepositoryConfigExtension.java @@ -21,8 +21,12 @@ import java.util.Locale; import java.util.Optional; +import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.data.jdbc.core.convert.JdbcConverter; +import org.springframework.data.jdbc.core.mapping.JdbcMappingContext; import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactoryBean; +import org.springframework.data.relational.core.dialect.Dialect; import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport; import org.springframework.data.repository.config.RepositoryConfigurationSource; @@ -74,6 +78,10 @@ public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSo Optional transactionManagerRef = source.getAttribute("transactionManagerRef"); builder.addPropertyValue("transactionManager", transactionManagerRef.orElse(DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)); + + builder.addPropertyValue("mappingContext", new RuntimeBeanReference(JdbcMappingContext.class)); + builder.addPropertyValue("dialect", new RuntimeBeanReference(Dialect.class)); + builder.addPropertyValue("converter", new RuntimeBeanReference(JdbcConverter.class)); } /** diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java index f1bd68781fb..f0d5390a69e 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java @@ -95,7 +95,6 @@ protected RepositoryFactorySupport doCreateRepositoryFactory() { return jdbcRepositoryFactory; } - @Autowired public void setMappingContext(RelationalMappingContext mappingContext) { Assert.notNull(mappingContext, "MappingContext must not be null"); @@ -104,7 +103,6 @@ public void setMappingContext(RelationalMappingContext mappingContext) { this.mappingContext = mappingContext; } - @Autowired public void setDialect(Dialect dialect) { Assert.notNull(dialect, "Dialect must not be null"); @@ -141,7 +139,6 @@ public void setJdbcOperations(NamedParameterJdbcOperations operations) { this.operations = operations; } - @Autowired public void setConverter(JdbcConverter converter) { Assert.notNull(converter, "JdbcConverter must not be null");