java – HikariPool-1 – driverClassName需要jdbcUrl
发布时间:2020-12-14 06:02:31 所属栏目:Java 来源:网络整理
导读:我回去编程我的旧程序 https://github.com/JonkiPro/REST-Web-Services.我已经将Spring Boot从版本15.6更新到版本2.0.0.我在编译时遇到了很多问题,但我无法处理.好吧,在编译期间,他把我扔进了控制台 2018-03-18 21:54:53.339 ERROR 3220 --- [ost-startStop-
我回去编程我的旧程序
https://github.com/JonkiPro/REST-Web-Services.我已经将Spring Boot从版本15.6更新到版本2.0.0.我在编译时遇到了很多问题,但我无法处理.好吧,在编译期间,他把我扔进了控制台
2018-03-18 21:54:53.339 ERROR 3220 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : HikariPool-1 - jdbcUrl is required with driverClassName. 2018-03-18 21:54:55.392 INFO 3220 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'unit' 2018-03-18 21:54:56.698 INFO 3220 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'unit' 2018-03-18 21:54:56.778 ERROR 3220 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : HikariPool-1 - jdbcUrl is required with driverClassName. 2018-03-18 21:54:56.782 ERROR 3220 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService' defined in file [C:UsersJonatanDocumentsGitHubREST-Web-ServicesweboutproductionclassescomwebwebsecurityserviceimplUserDetailsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#65d6e77b' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#65d6e77b': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName. 2018-03-18 21:54:56.821 WARN 3220 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat 我从未犯过这样的错误.我完全不知道这意味着什么.我的基地属性看起来像这样 spring: datasource: driver-class-name: org.postgresql.Driver url: jdbc:postgresql:database username: root password: root schema: classpath:/db/init/schema.sql 我不知道如何处理这个错误.我已经编程了很长时间,但我第一次遇到了hikari的概念.我正在使用Tomcat(在Spring Boot中)服务器和PostgreSQL数据库. 解决方法
我在另一个背景下遇到了同样的问题.
从 79. Data Access – Configure a Custom DataSource
Hikari是spring boot 2中的默认池. 所以你可以替换配置 或者您可以保留配置但是您需要定义另一个Bean来处理映射(别名) @Bean @Primary @ConfigurationProperties("app.datasource") public DataSourceProperties dataSourceProperties() { return new DataSourceProperties(); } @Bean @ConfigurationProperties("app.datasource") public DataSource dataSource(DataSourceProperties properties) { return properties.initializeDataSourceBuilder(). .build(); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |