Skip to content

Commit ce08ae2

Browse files
author
mhyeon-lee
committed
Guard JdbcPlusRepositoryFactoryBean against setting null values for properties.
spring-projects/spring-data-relational@fc8d51c (cherry picked from commit 5e9f305)
1 parent fbd1b63 commit ce08ae2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spring-data-jdbc-plus-repository/src/main/java/com/navercorp/spring/data/jdbc/plus/repository/support/JdbcPlusRepositoryFactoryBean.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ protected RepositoryFactorySupport doCreateRepositoryFactory() {
108108
@Autowired
109109
protected void setMappingContext(RelationalMappingContext mappingContext) {
110110

111+
Assert.notNull(mappingContext, "MappingContext must not be null");
112+
111113
super.setMappingContext(mappingContext);
112114
this.mappingContext = mappingContext;
113115
}
@@ -119,6 +121,9 @@ protected void setMappingContext(RelationalMappingContext mappingContext) {
119121
*/
120122
@Autowired
121123
protected void setDialect(Dialect dialect) {
124+
125+
Assert.notNull(dialect, "Dialect must not be null");
126+
122127
this.dialect = dialect;
123128
}
124129

@@ -128,6 +133,9 @@ protected void setDialect(Dialect dialect) {
128133
* @param dataAccessStrategy can be {@literal null}.
129134
*/
130135
public void setDataAccessStrategy(DataAccessStrategy dataAccessStrategy) {
136+
137+
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null");
138+
131139
this.dataAccessStrategy = dataAccessStrategy;
132140
}
133141

@@ -140,6 +148,9 @@ public void setDataAccessStrategy(DataAccessStrategy dataAccessStrategy) {
140148
*/
141149
@Autowired(required = false)
142150
public void setQueryMappingConfiguration(QueryMappingConfiguration queryMappingConfiguration) {
151+
152+
Assert.notNull(queryMappingConfiguration, "QueryMappingConfiguration must not be null");
153+
143154
this.queryMappingConfiguration = queryMappingConfiguration;
144155
}
145156

@@ -149,6 +160,9 @@ public void setQueryMappingConfiguration(QueryMappingConfiguration queryMappingC
149160
* @param operations the operations
150161
*/
151162
public void setJdbcOperations(NamedParameterJdbcOperations operations) {
163+
164+
Assert.notNull(operations, "NamedParameterJdbcOperations must not be null");
165+
152166
this.operations = operations;
153167
}
154168

@@ -159,6 +173,9 @@ public void setJdbcOperations(NamedParameterJdbcOperations operations) {
159173
*/
160174
@Autowired
161175
public void setConverter(JdbcConverter converter) {
176+
177+
Assert.notNull(converter, "JdbcConverter must not be null");
178+
162179
this.converter = converter;
163180
}
164181

0 commit comments

Comments
 (0)