创建名称为 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration' 的 bean 时出错:

Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration':

我目前正在 Spring Vaadin 项目中添加 Spring 数据。 我不知道如何解决这个问题(我很确定我做的一切都很好,所以我 post 我得到了什么:

堆栈跟踪:

 2017-01-10 17:41:14.121  INFO 26183 --- [nio-8090-exec-3] c.vaadin.spring.server.SpringUIProvider  : Found Vaadin UI [com.reborn.simtrade.ui.SimtradeUI]
2017-01-10 17:41:32.910 ERROR 26183 --- [nio-8090-exec-9] com.vaadin.server.DefaultErrorHandler    : 

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'loginView': Unsatisfied dependency expressed through field 'accountRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.reborn.simtrade.backend.repositories.AccountRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:592) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:370) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:345) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at com.vaadin.spring.internal.BeanStore.create(BeanStore.java:71) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.spring.internal.UIScopeImpl$UIBeanStore.create(UIScopeImpl.java:279) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.spring.internal.BeanStore.get(BeanStore.java:62) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.spring.internal.SessionLockingBeanStore.get(SessionLockingBeanStore.java:46) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.spring.internal.UIScopeImpl.get(UIScopeImpl.java:81) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at com.vaadin.spring.navigator.SpringViewProvider.getViewFromApplicationContextAndCheckAccess(SpringViewProvider.java:312) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.spring.navigator.SpringViewProvider.getViewFromApplicationContext(SpringViewProvider.java:301) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.spring.navigator.SpringViewProvider.getView(SpringViewProvider.java:274) ~[vaadin-spring-1.0.0.jar:1.0.0]
    at com.vaadin.navigator.Navigator.navigateTo(Navigator.java:554) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.reborn.simtrade.ui.home.SplashScreen.redirect(SplashScreen.java:72) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1015) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.ui.Button.fireClick(Button.java:377) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.ui.Button.click(Button.java:54) ~[vaadin-server-7.7.6.jar:7.7.6]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:119) ~[vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:435) [vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:407) [vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:273) [vaadin-server-7.7.6.jar:7.7.6]
    at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90) [vaadin-server-7.7.6.jar:7.7.6]
    at 

登录视图:

@UIScope
@SpringView(name=ViewTokens.SIGNIN)
public class LoginView extends VerticalLayout implements View {

@Autowired
AccountRepository accountRepository;

private static final float PANEL_WIDTH = 440;
private static final float PANEL_HEIGHT = 260;
private static final float COMPONENT_WIDTH = 260;
private static final float COMPONENT_HEIGHT = 45;

private ComponentHelper componentHelper;
private Notification errorNotify;
private Panel loginPanel;
private FormLayout loginForm;
private TextField loginField;
private PasswordField passwordField;
private Button signInButton;

public LoginView() {
    initComponents();
    buildLoginView();
}

protected void initComponents() {
<ommitted>
}

private void buildLoginView() {
   <ommitted>
}

public void signIn(Button.ClickEvent event) {
    doSignIn(loginField.getValue(), passwordField.getValue());
    loginField.clear();
    passwordField.clear();
}

private void doSignIn(String username, String password) {
    <omitted>
    Account account = accountRepository.findByUsername(loginField.getValue(), passwordField.getValue());
    Notification.show(account.toString());
}

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
    }
}

到目前为止我已经尝试使用 setter 方法 - 仍然没有结果。

P.S 这可能会有所帮助 - 在应用程序启动时 spring 数据会初始化 schema.sql 和 data.sql 脚本。

您似乎缺少用 @Repository 注释 com.reborn.simtrade.backend.repositories.AccountRepository,如:

package com.reborn.simtrade.backend.repositories;

import org.springframework.stereotype.Repository;

@Repository
public class AccountRepository{

}