Polish "Replace relevant code with lambda"
Closes gh-1454
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
|
||||
package org.springframework.jdbc.core.support;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -105,10 +102,10 @@ public class JdbcBeanDefinitionReader {
|
||||
public void loadBeanDefinitions(String sql) {
|
||||
Assert.notNull(this.jdbcTemplate, "Not fully configured - specify DataSource or JdbcTemplate");
|
||||
final Properties props = new Properties();
|
||||
this.jdbcTemplate.query(sql, resultSet -> {
|
||||
String beanName = resultSet.getString(1);
|
||||
String property = resultSet.getString(2);
|
||||
String value = resultSet.getString(3);
|
||||
this.jdbcTemplate.query(sql, rs -> {
|
||||
String beanName = rs.getString(1);
|
||||
String property = rs.getString(2);
|
||||
String value = rs.getString(3);
|
||||
// Make a properties entry by combining bean name and property.
|
||||
props.setProperty(beanName + '.' + property, value);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user