Accessing PostgreSQL 9.6 from Spring Boot

java

#1

Hello,

I have a Spring Boot application that currently builds and runs tests in Heroku’s CI and I’m trying to get it to work in Circle CI as well. My config file looks like this:

version: 2
jobs:
  build:
    docker:
      - image: circleci/jdk8:0.1.1
      - image: postgres:9.6
    working_directory: ~/repo

    environment:
      # Customize the JVM maximum heap limit
      JVM_OPTS: -Xmx3200m
      TERM: dumb

    steps:
      - checkout
      - run: chmod +x gradlew

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "build.gradle" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: ./gradlew dependencies

      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "build.gradle" }}

      # run tests!
      - run: ./gradlew test

I tried defining a DATABASE_URL to default settings, to custom settings, to port 5432 as well as 5433 and nothing seems to work, I always end up with this error:

tech.dashman.dashmanserver.models.AccountTest > create FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.beans.BeanInstantiationException
                Caused by: org.springframework.beans.factory.BeanCreationException
                    Caused by: org.springframework.beans.BeanInstantiationException
                        Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException

tech.dashman.dashmanserver.models.UserTest > create FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.beans.BeanInstantiationException
                Caused by: org.springframework.beans.factory.BeanCreationException
                    Caused by: org.springframework.beans.BeanInstantiationException
                        Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException

tech.dashman.dashmanserver.DashmanserverApplicationTests > contextLoads FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.beans.BeanInstantiationException
                Caused by: org.springframework.beans.factory.BeanCreationException
                    Caused by: org.springframework.beans.BeanInstantiationException
                        Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException

What’s the proper way of configuring the database? I’m a bit lost.


#2

What are you using for the connection string in this most recent attempt?


#3