简体   繁体   中英

how to configure both mongodb and postgres in spring boot application.yml?

We have spring boot project , in which we need to use mongo and postgres , but i thought am failing in configuring mongo and postgres details applicaiton.yml , below my what i configured , can any one please help me

spring:
    profiles: stage
    data:
      mongodb:
        host: mongodb-host
        port: 27017
        password: password
        username: username
        authentication-database: database
        database: database
    datasource:
        driver-class-name: org.postgresql.Driver
        url: postgres-url
        username: user-name
        password: password
        tomcat:
          validation-interval: 30000
          test-on-borrow: true
          validation-query: SELECT 1

when i start my spring-boot application , it is failing to start with below error

Caused by: java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.

can any one please help

Solution 1: remove spring.datasource.driver-class-name property

Solution 2: rename the spring.datasource.url property to spring.datasource.jdbc-url .

For solution 1 Spring Boot will figure out the default driver class name based on the spring.datasource.url property value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM