No bean named 'entityManagerFactory' available

image

image

image

image

image

上面是代码:
下面是错误:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userController’: Unsatisfied dependency expressed through field ‘userRepository’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userDao’: Cannot create inner bean ‘(inner bean)#4f66ffc8’ of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property ‘entityManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘(inner bean)#4f66ffc8’: Cannot resolve reference to bean ‘entityManagerFactory’ while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘entityManagerFactory’ available

数据库:本地, 名称 weifuwu, 没有创建表。 因为文档说 可以自动创建表
image

在Main类添加一个注解。

@EntityScan

使用 basePackages 属性,指定你的 entity包的

我不知道com.wfw.wfwdemo.Daocom.wfw.wfwdemo.Service什么意思,咱也不敢问,不建议package大写

建议

  • Appliaction类放到父包下

参考

https://github.com/spring-projects/spring-boot/issues/256

估计你数据库连接那里有问题

image
这样吗? 不管用

不太懂你说的,看了下连接也是比较蒙。
我心创建了一个项目,都放在一个目录里面了,也是报错。

我看字符串 和数据库名称 没错~~

看看你maven中的data-jpa是不是指定了版本,如果指定了,请去掉,让他跟随springboot默认定义的版本走