Skip to content

Allow to use generic qualifiers for statemachine factory #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tarioch opened this issue Jan 17, 2017 · 1 comment
Closed

Allow to use generic qualifiers for statemachine factory #306

tarioch opened this issue Jan 17, 2017 · 1 comment
Labels
type/enhancement Is an enhancement request
Milestone

Comments

@tarioch
Copy link
Contributor

tarioch commented Jan 17, 2017

We already have generics on StateMachineConfigurerAdaptor. It should be possible to use those as qualifiers instead of having to set different names and use the string names as qualifiers.

With this we would no longer need to do
@EnableStateMachineFactory(name="Foo")

And use would be instead of

@Autowired
@Qualifier("Foo")
private StateMachineFactory<MyState, MyEvent> myFooMachine;

@Autowired
@Qualifier("Bar")
private StateMachineFactory<MyBarState, MyBarEvent> myBarMachine;

it would be

@Autowired
private StateMachineFactory<MyState, MyEvent> myFooMachine;

@Autowired
private StateMachineFactory<MyBarState, MyBarEvent> myBarMachine;

As they have different generics

@jvalkeal jvalkeal added the type/enhancement Is an enhancement request label Feb 10, 2017
@jvalkeal jvalkeal added this to the 1.2.2.RELEASE milestone Feb 10, 2017
jvalkeal added a commit to jvalkeal/spring-statemachine that referenced this issue Feb 10, 2017
- Modify StateMachineConfiguration and StateMachineFactoryConfiguration
  so that if you have different states and events classes with multiple
  machines or factories, you can autowire by types without
  adding qualifiers.
- Manually try to discover generic types from enclosing adapther class
  and if succesfull pass that information into bean definition
  as ResolvableType.
- Fixes spring-projects#306
jvalkeal added a commit that referenced this issue Feb 10, 2017
- Modify StateMachineConfiguration and StateMachineFactoryConfiguration
  so that if you have different states and events classes with multiple
  machines or factories, you can autowire by types without
  adding qualifiers.
- Manually try to discover generic types from enclosing adapther class
  and if succesfull pass that information into bean definition
  as ResolvableType.
- Backporting #306
- Relates to #307
@jvalkeal
Copy link
Contributor

@tarioch hopefully fixed in 1.2.2.BUILD-SNAPSHOT, give it a spin. Master build in currently ongoing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Is an enhancement request
Projects
None yet
Development

No branches or pull requests

2 participants