我有一个非常简单的
sample
Spring Boot+Kotlin项目。
我添加了所有基本依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
我用JPA注释注释了两个模型类:
@Entity
class Author(
@Id @GeneratedValue(strategy = GenerationType.AUTO) val id: Long,
val firstName: String,
val lastName: String,
@ManyToMany(mappedBy = "authors") val books: Set<Book> = emptySet()
)
和
@Entity
class Book(
@Id @GeneratedValue(strategy = GenerationType.AUTO)
val id: Long,
@ManyToMany @JoinTable(
name = "author_book",
joinColumns = [JoinColumn(name = "book_id")],
inverseJoinColumns = [(JoinColumn(name = "author_id"))])
val author: Set<Author> = emptySet(),
val title: String,
val label: String,
val publisher: String
)
我有一个基本的主线:
@SpringBootApplication
open class Spring5webappApplication {
companion object {
@JvmStatic
fun main(args: Array<String>) {
SpringApplication.run(Spring5webappApplication::class.java, *args)
}
}
}
But when I boot, I get a bit error stack.
你能给我一些线索吗?我在谷歌上搜索了错误,但答案太不相关了。谢谢