【发布时间】:2018-08-24 11:05:44
【问题描述】:
我正在尝试将 JPA Maven 依赖项添加到已创建的 spring-boot 项目中,但出现以下错误:
Error: Could not find or load main class com.kame.demo.DemoApplication
当我删除它时,错误就消失了。
pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>8.5.32</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
application.properties
spring.mvc.view.prefix=/pages/
spring.mvc.view.suffix=.jsp
spring.h2.console.enabled=true
spring.datasource.platform=h2
spring.datasource.url=jdbc:h2:mem:navin
我试图在网上找到答案,但没有一个适合我的解决方案。
还尝试创建 > Spring starter project > 并立即添加 JPA、Web 和 H2 但仍然相同的错误。
我正在使用 STS IDE,可能与它有关吗?
【问题讨论】:
标签: java spring spring-boot spring-data-jpa