File tree 2 files changed +11
-2
lines changed
main/java/org/springframework/security/authentication/ott
test/java/org/springframework/security/authentication/ott 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 30
30
import org .apache .commons .logging .Log ;
31
31
import org .apache .commons .logging .LogFactory ;
32
32
33
+ import org .springframework .beans .factory .DisposableBean ;
33
34
import org .springframework .jdbc .core .ArgumentPreparedStatementSetter ;
34
35
import org .springframework .jdbc .core .JdbcOperations ;
35
36
import org .springframework .jdbc .core .PreparedStatementSetter ;
55
56
* @author Max Batischev
56
57
* @since 6.4
57
58
*/
58
- public final class JdbcOneTimeTokenService implements OneTimeTokenService {
59
+ public final class JdbcOneTimeTokenService implements OneTimeTokenService , DisposableBean {
59
60
60
61
private final Log logger = LogFactory .getLog (getClass ());
61
62
@@ -187,6 +188,13 @@ public void cleanUpExpiredTokens() {
187
188
this .logger .debug ("Cleaned up " + deletedCount + " expired tokens" );
188
189
}
189
190
191
+ @ Override
192
+ public void destroy () throws Exception {
193
+ if (this .taskScheduler != null ) {
194
+ this .taskScheduler .shutdown ();
195
+ }
196
+ }
197
+
190
198
/**
191
199
* Sets the {@link Clock} used when generating one-time token and checking token
192
200
* expiry.
Original file line number Diff line number Diff line change @@ -68,8 +68,9 @@ void setUp() {
68
68
}
69
69
70
70
@ AfterEach
71
- public void tearDown () {
71
+ public void tearDown () throws Exception {
72
72
this .db .shutdown ();
73
+ this .oneTimeTokenService .destroy ();
73
74
}
74
75
75
76
private static EmbeddedDatabase createDb () {
You can’t perform that action at this time.
0 commit comments