From af025b768a5f9d0ccddc7c852d81aa997ebd2b75 Mon Sep 17 00:00:00 2001 From: hmdrz Date: Thu, 19 Dec 2024 13:50:07 +0330 Subject: [PATCH 1/7] #BAEL-8370-New: add Jobs --- .../java/com/baeldung/actuator/JobConfig.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/JobConfig.java diff --git a/spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/JobConfig.java b/spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/JobConfig.java new file mode 100644 index 000000000000..28b3e487b172 --- /dev/null +++ b/spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/JobConfig.java @@ -0,0 +1,26 @@ +package com.baeldung.actuator; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +@Configuration +@EnableScheduling +public class JobConfig { + + @Scheduled(fixedDelay = 1000L) + public void scheduleFixedDelayTask() { + System.out.println("Fixed delay task - " + System.currentTimeMillis() / 1000); + } + + @Scheduled(fixedRate = 1000L) + public void scheduleFixedRateTask() { + System.out.println("Fixed rate task - " + System.currentTimeMillis() / 1000); + } + + @Scheduled(cron = "0 15 10 15 * ?") + public void scheduleTaskUsingCronExpression() { + long now = System.currentTimeMillis() / 1000; + System.out.println("schedule tasks using cron jobs - " + now); + } +} \ No newline at end of file From 791ed6e29bee5a4934417f1202c9a7513e6fb26a Mon Sep 17 00:00:00 2001 From: hmdrz Date: Thu, 19 Dec 2024 13:50:21 +0330 Subject: [PATCH 2/7] #BAEL-8370-New: add SecurityConfig --- .../com/baeldung/actuator/SecurityConfig.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/SecurityConfig.java diff --git a/spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/SecurityConfig.java b/spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/SecurityConfig.java new file mode 100644 index 000000000000..cd56067dd139 --- /dev/null +++ b/spring-boot-modules/spring-boot-simple/src/main/java/com/baeldung/actuator/SecurityConfig.java @@ -0,0 +1,21 @@ +package com.baeldung.actuator; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + + @Bean + public SecurityFilterChain securityWebFilterChain(HttpSecurity http) throws Exception { + return http + .authorizeHttpRequests(auth -> auth + .requestMatchers("/actuator/**").permitAll() + .anyRequest().authenticated()) + .build(); + } +} \ No newline at end of file From fbf3f917ee8e975948faad0d0ef58d13f97f81d2 Mon Sep 17 00:00:00 2001 From: hmdrz Date: Thu, 19 Dec 2024 13:50:30 +0330 Subject: [PATCH 3/7] #BAEL-8370-New: update Spring Boot version to 3.4.0 --- parent-boot-3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-boot-3/pom.xml b/parent-boot-3/pom.xml index ff615a565466..66dbc0d13196 100644 --- a/parent-boot-3/pom.xml +++ b/parent-boot-3/pom.xml @@ -227,7 +227,7 @@ 3.2.0 3.12.1 3.3.0 - 3.3.2 + 3.4.0 5.11.0-M2 0.9.17 From ee98476c0d54b3d967f4276a0a98687dd84dd832 Mon Sep 17 00:00:00 2001 From: hmdrz Date: Thu, 19 Dec 2024 15:22:38 +0330 Subject: [PATCH 4/7] #BAEL-8370-New: add htmlunit.version to spring-boot-rest module --- spring-boot-rest/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index 905deb15eb7f..5877338b599a 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -119,6 +119,7 @@ net.sourceforge.htmlunit htmlunit + ${htmlunit.version} test @@ -175,5 +176,6 @@ 5.5.0 4.0.1 6.1.4 + 2.32 From 4755d9da48c210ee7c29b7cdb012b3cc4b1dee6b Mon Sep 17 00:00:00 2001 From: hmdrz Date: Sun, 22 Dec 2024 23:52:25 +0330 Subject: [PATCH 5/7] #BAEL-8370-New: revert Spring Boot version --- parent-boot-3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-boot-3/pom.xml b/parent-boot-3/pom.xml index 66dbc0d13196..ff615a565466 100644 --- a/parent-boot-3/pom.xml +++ b/parent-boot-3/pom.xml @@ -227,7 +227,7 @@ 3.2.0 3.12.1 3.3.0 - 3.4.0 + 3.3.2 5.11.0-M2 0.9.17 From e86405c9b71a4a411650f7864f567c9a66d51355 Mon Sep 17 00:00:00 2001 From: m_mohammadi Date: Tue, 24 Dec 2024 22:13:58 +0330 Subject: [PATCH 6/7] #BAEL-8370-NEW: revert htmlunit version --- spring-boot-rest/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index 5877338b599a..34f13b9859e4 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -119,7 +119,6 @@ net.sourceforge.htmlunit htmlunit - ${htmlunit.version} test @@ -176,6 +175,5 @@ 5.5.0 4.0.1 6.1.4 - 2.32 - + \ No newline at end of file From 2f735e1cc1628f729851c6661dccb96fce9efa35 Mon Sep 17 00:00:00 2001 From: m_mohammadi Date: Tue, 24 Dec 2024 23:01:54 +0330 Subject: [PATCH 7/7] #BAEL-8370-NEW: update Spring Boot version to 3.4.0 --- parent-boot-3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-boot-3/pom.xml b/parent-boot-3/pom.xml index ff615a565466..66dbc0d13196 100644 --- a/parent-boot-3/pom.xml +++ b/parent-boot-3/pom.xml @@ -227,7 +227,7 @@ 3.2.0 3.12.1 3.3.0 - 3.3.2 + 3.4.0 5.11.0-M2 0.9.17