Created
June 27, 2017 05:15
-
-
Save calvincodes/80aae83c069248be9f83b9609f0d4620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app; | |
@SpringBootApplication | |
// This annotation is a combination of @Configuration, @EnableAutoConfiguration and @ComponentScan | |
public class Application implements CommandLineRunner { | |
@Autowired | |
private StateMachine<States, Events> stateMachine; | |
public static void main(String[] args) { | |
// Used to bootstrap and run Spring application from Java main method | |
SpringApplication.run(Application.class, args); | |
} | |
@Override | |
// Provided by CommandLineRunner, will be called just before SpringApplication.run() completes. | |
public void run(String... strings) throws Exception { | |
// In our case, this is used to indicate that the bean stateMachine, contained within the | |
// spring application should be executed the following way. | |
stateMachine.sendEvent(Events.E1); | |
stateMachine.sendEvent(Events.E2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment