Skip to content

Instantly share code, notes, and snippets.

@calvincodes
Created June 27, 2017 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvincodes/80aae83c069248be9f83b9609f0d4620 to your computer and use it in GitHub Desktop.
Save calvincodes/80aae83c069248be9f83b9609f0d4620 to your computer and use it in GitHub Desktop.
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