Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -129,7 +129,7 @@ public class EventPublicationInterceptorTests {
|
|||||||
public static class FactoryBeanTestListener extends TestListener implements FactoryBean<Object> {
|
public static class FactoryBeanTestListener extends TestListener implements FactoryBean<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getObject() throws Exception {
|
public Object getObject() {
|
||||||
return "test";
|
return "test";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ public class PayloadApplicationEventTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEventClassWithInterface() {
|
public void testEventClassWithInterface() {
|
||||||
ApplicationContext ac = new AnnotationConfigApplicationContext(Listener.class);
|
ApplicationContext ac = new AnnotationConfigApplicationContext(AuditableListener.class);
|
||||||
MyEventClass event = new MyEventClass<>(this, "xyz");
|
AuditablePayloadEvent event = new AuditablePayloadEvent<>(this, "xyz");
|
||||||
ac.publishEvent(event);
|
ac.publishEvent(event);
|
||||||
assertTrue(ac.getBean(Listener.class).events.contains(event));
|
assertTrue(ac.getBean(AuditableListener.class).events.contains(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -46,20 +46,17 @@ public class PayloadApplicationEventTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class MyEventClass<GT> extends PayloadApplicationEvent<GT> implements Auditable {
|
@SuppressWarnings("serial")
|
||||||
|
public static class AuditablePayloadEvent<T> extends PayloadApplicationEvent<T> implements Auditable {
|
||||||
|
|
||||||
public MyEventClass(Object source, GT payload) {
|
public AuditablePayloadEvent(Object source, T payload) {
|
||||||
super(source, payload);
|
super(source, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "Payload: " + getPayload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public static class Listener {
|
public static class AuditableListener {
|
||||||
|
|
||||||
public final List<Auditable> events = new ArrayList<>();
|
public final List<Auditable> events = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -612,6 +612,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
|||||||
((ParameterDisposer) psc).cleanupParameters();
|
((ParameterDisposer) psc).cleanupParameters();
|
||||||
}
|
}
|
||||||
String sql = getSql(psc);
|
String sql = getSql(psc);
|
||||||
|
psc = null;
|
||||||
JdbcUtils.closeStatement(ps);
|
JdbcUtils.closeStatement(ps);
|
||||||
ps = null;
|
ps = null;
|
||||||
DataSourceUtils.releaseConnection(con, getDataSource());
|
DataSourceUtils.releaseConnection(con, getDataSource());
|
||||||
@@ -1053,6 +1054,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
|||||||
((ParameterDisposer) csc).cleanupParameters();
|
((ParameterDisposer) csc).cleanupParameters();
|
||||||
}
|
}
|
||||||
String sql = getSql(csc);
|
String sql = getSql(csc);
|
||||||
|
csc = null;
|
||||||
JdbcUtils.closeStatement(cs);
|
JdbcUtils.closeStatement(cs);
|
||||||
cs = null;
|
cs = null;
|
||||||
DataSourceUtils.releaseConnection(con, getDataSource());
|
DataSourceUtils.releaseConnection(con, getDataSource());
|
||||||
|
|||||||
Reference in New Issue
Block a user