我正在尝试让spring状态机数据jpa样本工作,但我无法。我在这里创建了一个样本github项目。到目前为止,我只添加了必要的依赖项,并得到了这个错误:
由以下原因引起:org.springframework.beans.factory.NoSuchBeanDefinitionException:没有可用的"org.springfframework.statemachine.data.StateRepository"类型的合格bean:应至少有1个符合autowire候选条件的bean。依赖项注释:{@org.springframework.beans.factory.annotation.Autowired(required=true)}位于org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1493)位于org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104)位于org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)位于org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAannotationBeanpostProcessor.java:585)位于org.springframework.beans.factory.annotation.InjectionMetadata.inject(Injection元数据.java:88)位于org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAannotationBeanpostProcessor.java:366)位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
也许您已经明白了这一点,但您缺少jpa-libs。可以添加,即使用spring-boot-starter-data-jpa