From 8be6ffd2fed36025c94ad021c5e0c92702286fa2 Mon Sep 17 00:00:00 2001 From: Lukas Krecan Date: Mon, 25 Nov 2024 20:22:23 +0100 Subject: [PATCH] Extract ShedlockConfig in test --- .../shedlock/test/boot/Application.java | 8 -------- .../shedlock/test/boot/ShedlockConfig.java | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/ShedlockConfig.java diff --git a/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/Application.java b/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/Application.java index 332124e7b..5bc5efa83 100644 --- a/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/Application.java +++ b/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/Application.java @@ -13,13 +13,9 @@ */ package net.javacrumbs.shedlock.test.boot; -import javax.sql.DataSource; -import net.javacrumbs.shedlock.core.LockProvider; -import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider; import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @@ -31,8 +27,4 @@ public static void main(String[] args) { SpringApplication.run(Application.class); } - @Bean - public LockProvider lockProvider(DataSource dataSource) { - return new JdbcTemplateLockProvider(dataSource, "shedlock"); - } } diff --git a/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/ShedlockConfig.java b/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/ShedlockConfig.java new file mode 100644 index 000000000..bd0ca31b4 --- /dev/null +++ b/spring/test/shedlock-springboot-test/src/main/java/net/javacrumbs/shedlock/test/boot/ShedlockConfig.java @@ -0,0 +1,15 @@ +package net.javacrumbs.shedlock.test.boot; + +import javax.sql.DataSource; +import net.javacrumbs.shedlock.core.LockProvider; +import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ShedlockConfig { + @Bean + public LockProvider lockProvider(DataSource dataSource) { + return new JdbcTemplateLockProvider(dataSource, "shedlock"); + } +}