• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Spring StateMachine - reaction to changing states

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote the implementation of the state machine, using the Spring guide.

But I can’t achieve any reaction for changing the states, although the states themselves change successfully. Perhaps I misunderstood the goal of the Beans class? I need to achieve automatic execution of the closeDoor() and startMoving() methods when the corresponding state changes.

These messages in the methods on the console are not displayed:



Configuration:



Builder:



And the launch (the states are displayed correctly in the console, according to the events):



Dependency is only one.


What I'm doing wrong?
 
Andrey Mironov
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a solution.

The problem was the simultaneous use of the @WithStateMachine annotation and Builder.getMachine(), which contradicted each other.
 
Marshal
Posts: 65034
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done finding that solution
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Java Code Review and Psychology
https://coderanch.com/t/714798/java/Java-Code-Review-Psychology
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!