春季启动和数据源生成

时间:2019-10-09 14:11:58

标签: spring spring-boot jpa orm

我正在尝试在STS 4的Spring引导中进行ORM,因此我创建了实体,然后按如下所示配置application.properties:

spring.datasource.url = jdbc:mysql://localhost:3306/basebanque

spring.datasource.username = root

spring.datasource.password = 

spring.datasource.driver-class-name=com.mysql.jdbc.Driver

spring.jpa.database= MYSQL

spring.jpa.show-sql = true 

spring.jpa.hibernate.ddl-auto=create

spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5Dialect

我没有获得任何数据源的问题。 控制台显示以下内容: screen shot 1

和:

enter image description here

1 个答案:

答案 0 :(得分:1)

检查要扫描的实体。

https://springbootdev.com/2017/11/13/what-are-the-uses-of-entityscan-and-enablejparepositories-annotations/amp/

默认情况下,Spring Boot将启用实体扫描并查看@SpringBootApplication所在的包(及其子包)。如果您的配置在另一个包中包含实体,请使用@EntityScan。

相关问题