Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 创建名为';***的bean时出错。jpa.HibernateJpaConfiguration&x27;_Java_Spring_Spring Boot_Hibernate_Sqlite - Fatal编程技术网

Java 创建名为';***的bean时出错。jpa.HibernateJpaConfiguration&x27;

Java 创建名为';***的bean时出错。jpa.HibernateJpaConfiguration&x27;,java,spring,spring-boot,hibernate,sqlite,Java,Spring,Spring Boot,Hibernate,Sqlite,我试图在Spring引导应用程序中使用SQLite。 但是应用程序无法创建下面的bean org.springframework.boot.autoconfigure.orm.jpa.hibernatejpac配置 我该怎么办? 我在这个网站上搜索了相关问题,但没有找到合适的问题 pom.xml如下所示 <?xml version="1.0" encoding="UTF-8"?> 上周,我已经多次回答了类似的问题。这里有一个: 您正在覆盖

我试图在Spring引导应用程序中使用SQLite。 但是应用程序无法创建下面的bean

org.springframework.boot.autoconfigure.orm.jpa.hibernatejpac配置

我该怎么办? 我在这个网站上搜索了相关问题,但没有找到合适的问题

pom.xml
如下所示

<?xml version="1.0" encoding="UTF-8"?>

上周,我已经多次回答了类似的问题。这里有一个:


您正在覆盖hibernate以使用非常旧的版本,该版本与您正在使用的Spring Boot版本不兼容。我相信这就是你出错的原因

由于您已经在使用
springbootstarterdatajpa
,因此实际上不需要定义以下工件。删除它们就行了

  • 弹簧靴启动器jdbc
  • javax.persistence
  • 休眠实体管理器
  • 休眠验证器
  • 弹簧启动机tomcat
  • sqlite jdbc
您的pom.xml将很简单,如下所示:注意,您不需要覆盖任何版本,也不需要

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
     
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
 
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
 
</dependencies>

org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
SpringBootStarterWeb
org.projectlombok
龙目
真的
org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机

当你问这样的问题时,请发布完整的stacktrace。嗨,gtiwari。谢谢你的评论。但是错误仍然存在。创建名为“getDataSource”的bean时出错,原因是:java.lang.RuntimeException:未能在任何一个HikariConfig类中加载驱动程序类org.sqlite.JDBC如何为sqlite指定JDBC类?请共享代码。你甚至没有分享stacktrace。
    spring.jpa.database-platform=com.luminous.spring.dialect.SQLDialect
spring.jpa.hibernate.ddl-auto=update

spring.datasource.url=jdbc:sqlite:employee.db
spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.initialization-mode=always

spring.datasource.username = admin
spring.datasource.password = admin
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
     
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
 
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
 
</dependencies>