Skip to content

Commit

Permalink
Guard JdbcPlusRepositoryFactoryBean against setting null values for p…
Browse files Browse the repository at this point in the history
…roperties.

spring-projects/spring-data-relational@fc8d51c
(cherry picked from commit 5e9f305)
  • Loading branch information
mhyeon-lee committed Oct 15, 2020
1 parent fbd1b63 commit ce08ae2
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit ce08ae2

Please sign in to comment.