【发布时间】:2021-07-16 06:35:08
【问题描述】:
这是我的build.gradle 文件依赖项,
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
implementation group: 'javax.persistence', name: 'javax.persistence-api', version: '2.2'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '2.4.1'
implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
}
我为学生创建了模型类。但我不能使用 @Entity 注释它标记为编译错误。如何使用 gradle 创建实体?
【问题讨论】:
-
你必须在你的
build.gradle中包含这个:implementation 'org.springframework.boot:spring-boot-starter-data-jpa'建议你使用start.spring.io来生成spring boot项目。你的 gradle 文件看起来很奇怪。
标签: java spring-boot jpa gradle spring-data-jpa