-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrafficsystemApplication.java
37 lines (29 loc) · 1.29 KB
/
TrafficsystemApplication.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.example.trafficsystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.statemachine.StateMachine;
@SpringBootApplication
public class TrafficsystemApplication implements ApplicationRunner {
@Autowired
private TrafficLight trafficLightService;
public static void main(String[] args) {
System.out.println("Akarsh");
SpringApplication.run(TrafficsystemApplication.class, args);
}
@Autowired
private StateMachine<TrafficLightState, TrafficLightEvent> stateMachine;
public void run(ApplicationArguments args) throws Exception {
// System.out.println("Inside run ");
// TrafficLight trafficLight = new TrafficLight(stateMachine);
// trafficLight.start();
System.out.println("In run method");
trafficLightService.startTrafficLight();
// Simulate timer events triggering state transitions
trafficLightService.triggerTimerExpiredEvent();
trafficLightService.triggerTimerExpiredEvent();
trafficLightService.triggerTimerExpiredEvent();
}
}