title=jdbcTemplate.queryForList("SELECT distinct title from UD_REGGRESSION where delete_flag='N'",String.class);
上述查询大约需要3到4秒才能执行,只提取了21条记录。在Toad中,执行相同的查询大约需要500到600毫秒。为什么时间上有这么大的差异?
类已完成配置。
@Configuration
@ConfigurationProperties(prefix = "oracle")
public class OracleConfiguration {
@NotNull
private String username;
@NotNull
private String password;
@NotNull
private String url;
@NotNull
private String decryptionKey;
public String getDecryptionKey() {
return decryptionKey;
}
public void setDecryptionKey(String decryptionKey) {
this.decryptionKey = decryptionKey;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getUrl() {
return url;
}
@Bean
public DataSource dataSource() throws SQLException {
OracleDataSource dataSource = new OracleDataSource();
dataSource.setUser(username);
dataSource.setPassword(password);
dataSource.setURL(url);
dataSource.setImplicitCachingEnabled(true);
dataSource.setFastConnectionFailoverEnabled(true);
return dataSource;
}
@PostConstruct
public void decrypt() {
this.password = DecryptUtility.decrypt(this.password,
this.decryptionKey);
}
}
有人建议可以采取哪些改进措施来获得更好的响应时间吗?