java - buildBeanDefinition failing with Spring Statemachine Framework -
i'm trying utilize spring statemachine framework in project, i'm encountering building bean definition error @ compile-time.
2017-07-25 16:37:25.462:warn:oejd.deploymentmanager:scanner-1: unable reach node goal: started java.lang.nosuchmethoderror: org.springframework.beans.factory.support.rootbeandefinition.settargettype(lorg/springframework/core/resolvabletype;)v @ org.springframework.statemachine.config.configuration.statemachineconfiguration.buildbeandefinition(statemachineconfiguration.java:109) @ org.springframework.statemachine.config.common.annotation.abstractimportingannotationconfiguration.registerbeandefinitions(abstractimportingannotationconfiguration.java:92) @ org.springframework.context.annotation.configurationclassbeandefinitionreader.loadbeandefinitionsfromregistrars(configurationclassbeandefinitionreader.java:352) @ org.springframework.context.annotation.configurationclassbeandefinitionreader.loadbeandefinitionsforconfigurationclass(configurationclassbeandefinitionreader.java:143) @ org.springframework.context.annotation.configurationclassbeandefinitionreader.loadbeandefinitions(configurationclassbeandefinitionreader.java:116) @ org.springframework.context.annotation.configurationclasspostprocessor.processconfigbeandefinitions(configurationclasspostprocessor.java:333) @ org.springframework.context.annotation.configurationclasspostprocessor.postprocessbeandefinitionregistry(configurationclasspostprocessor.java:243) @ org.springframework.context.support.postprocessorregistrationdelegate.invokebeandefinitionregistrypostprocessors(postprocessorregistrationdelegate.java:273) @ org.springframework.context.support.postprocessorregistrationdelegate.invokebeanfactorypostprocessors(postprocessorregistrationdelegate.java:98) @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:678) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:520) @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:444) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:326) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:107)
i'm following along step 7 in spring mvc application. not using springboot, don't think i'm missing sub-files.
here code statemachineconfig file:
import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.statemachine.config.enablestatemachine; import org.springframework.statemachine.config.enumstatemachineconfigureradapter; import org.springframework.statemachine.config.builders.statemachineconfigurationconfigurer; import org.springframework.statemachine.config.builders.statemachinestateconfigurer; import org.springframework.statemachine.config.builders.statemachinetransitionconfigurer; import org.springframework.statemachine.listener.statemachinelistener; import org.springframework.statemachine.listener.statemachinelisteneradapter; import org.springframework.statemachine.state.state; import java.util.enumset; @configuration @enablestatemachine public class statemachineconfig extends enumstatemachineconfigureradapter<states, events> { @override public void configure(statemachineconfigurationconfigurer<states, events> config) throws exception { config .withconfiguration() .autostartup(true) .listener(listener()); } @override public void configure(statemachinestateconfigurer<states, events> states) throws exception { states .withstates() .initial(states.si) .states(enumset.allof(states.class)); } @override public void configure(statemachinetransitionconfigurer<states, events> transitions) throws exception { transitions .withexternal() .source(states.si).target(states.s1).event(events.e1) .and() .withexternal() .source(states.s1).target(states.s2).event(events.e2); } @bean public statemachinelistener<states, events> listener() { return new statemachinelisteneradapter<states, events>() { @override public void statechanged(state<states, events> from, state<states, events> to) { system.out.println("state change " + to.getid()); } }; } }
this controller attempting use statemachine in (note: removed @autowired tag above instantiation of statemachine intellij kept saying "no beans of 'statemachine' type found". may culprit of problems?):
@controller @requestmapping("/") public class homecontroller { private statemachine<states, events> statemachine; @requestmapping(method = requestmethod.get) public string index() { statemachine.sendevent(events.e1); return "redirect:/target/list"; } }
nosuchmethoderror
if points spring core classes mean there mixup of framework versions. letting statemachine pom resolve versions , own build adds else.
your maven or gradle build file shows why core framework jars have different versions. if using boot you'd pretty correct versions, without need manage versions manually.
Comments
Post a Comment