Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.

Commit 9ecaed7

Browse files
authored
Merge pull request #70 from bright-room/claude/issue-55-20260309-1809
Close #55: Add WebMVC schedule example
2 parents 7adfd5a + 6baf7b4 commit 9ecaed7

7 files changed

Lines changed: 88 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
id("example-base")
3+
id("spotless-java")
4+
}
5+
6+
dependencies {
7+
implementation(project(":spring:spring-webmvc"))
8+
implementation(libs.spring.boot.starter.webmvc)
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package net.brightroom.example.schedule;
2+
3+
import net.brightroom.endpointgate.core.annotation.EndpointGate;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
@RestController
8+
public class BusinessHoursController {
9+
10+
@EndpointGate("business-hours")
11+
@GetMapping("/api/support/chat")
12+
public String supportChat() {
13+
return "Support chat is available";
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package net.brightroom.example.schedule;
2+
3+
import net.brightroom.endpointgate.core.annotation.EndpointGate;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
@RestController
8+
public class CampaignController {
9+
10+
@EndpointGate("campaign")
11+
@GetMapping("/api/campaign/deals")
12+
public String campaignDeals() {
13+
return "Special campaign deals available";
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package net.brightroom.example.schedule;
2+
3+
import net.brightroom.endpointgate.core.annotation.EndpointGate;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
@RestController
8+
public class MaintenanceController {
9+
10+
@EndpointGate("maintenance-window")
11+
@GetMapping("/api/maintenance/status")
12+
public String maintenanceStatus() {
13+
return "System is under maintenance";
14+
}
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package net.brightroom.example.schedule;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class ScheduleExampleApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(ScheduleExampleApplication.class, args);
11+
}
12+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
endpoint-gate:
2+
schedule:
3+
default-timezone: Asia/Tokyo
4+
gates:
5+
maintenance-window:
6+
enabled: true
7+
schedule:
8+
start: "2026-03-10T02:00:00"
9+
end: "2026-03-10T06:00:00"
10+
campaign:
11+
enabled: true
12+
schedule:
13+
start: "2026-03-01T00:00:00"
14+
end: "2026-03-31T23:59:59"
15+
timezone: Asia/Tokyo
16+
business-hours:
17+
enabled: true
18+
schedule:
19+
start: "2026-01-01T09:00:00"
20+
end: "2026-12-31T18:00:00"
21+
timezone: America/New_York

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ include(
4848
"examples:webmvc:health-indicator",
4949
"examples:webmvc:custom-rollout-strategy",
5050
"examples:webmvc:event-listener",
51+
"examples:webmvc:schedule",
5152
"examples:webmvc:condition",
5253
"examples:webflux:fail-behavior",
5354
"examples:webflux:error-handling",

0 commit comments

Comments
 (0)