From ce08ae212d1baaa4accb99f1d4558081dbe852dc Mon Sep 17 00:00:00 2001 From: mhyeon-lee Date: Thu, 15 Oct 2020 14:29:54 +0900 Subject: [PATCH] Guard JdbcPlusRepositoryFactoryBean against setting null values for properties. https://github.com/spring-projects/spring-data-jdbc/commit/fc8d51cd3be67c5f0abea9ed539728e702ab359f (cherry picked from commit 5e9f305ed9409deff920cd80ccc2d85c71e50867) --- .../support/JdbcPlusRepositoryFactoryBean.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spring-data-jdbc-plus-repository/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/support/JdbcPlusRepositoryFactoryBean.java b/spring-data-jdbc-plus-repository/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/support/JdbcPlusRepositoryFactoryBean.java index 60e4ef78..20e072cc 100644 --- a/spring-data-jdbc-plus-repository/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/support/JdbcPlusRepositoryFactoryBean.java +++ b/spring-data-jdbc-plus-repository/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/support/JdbcPlusRepositoryFactoryBean.java @@ -108,6 +108,8 @@ protected RepositoryFactorySupport doCreateRepositoryFactory() { @Autowired protected void setMappingContext(RelationalMappingContext mappingContext) { + Assert.notNull(mappingContext, "MappingContext must not be null"); + super.setMappingContext(mappingContext); this.mappingContext = mappingContext; } @@ -119,6 +121,9 @@ protected void setMappingContext(RelationalMappingContext mappingContext) { */ @Autowired protected void setDialect(Dialect dialect) { + + Assert.notNull(dialect, "Dialect must not be null"); + this.dialect = dialect; } @@ -128,6 +133,9 @@ protected void setDialect(Dialect dialect) { * @param dataAccessStrategy can be {@literal null}. */ public void setDataAccessStrategy(DataAccessStrategy dataAccessStrategy) { + + Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null"); + this.dataAccessStrategy = dataAccessStrategy; } @@ -140,6 +148,9 @@ public void setDataAccessStrategy(DataAccessStrategy dataAccessStrategy) { */ @Autowired(required = false) public void setQueryMappingConfiguration(QueryMappingConfiguration queryMappingConfiguration) { + + Assert.notNull(queryMappingConfiguration, "QueryMappingConfiguration must not be null"); + this.queryMappingConfiguration = queryMappingConfiguration; } @@ -149,6 +160,9 @@ public void setQueryMappingConfiguration(QueryMappingConfiguration queryMappingC * @param operations the operations */ public void setJdbcOperations(NamedParameterJdbcOperations operations) { + + Assert.notNull(operations, "NamedParameterJdbcOperations must not be null"); + this.operations = operations; } @@ -159,6 +173,9 @@ public void setJdbcOperations(NamedParameterJdbcOperations operations) { */ @Autowired public void setConverter(JdbcConverter converter) { + + Assert.notNull(converter, "JdbcConverter must not be null"); + this.converter = converter; }