Skip to content

spring - jpa data support #126

@mamaorha

Description

@mamaorha

I wasn't able to add jpa properly to the project, it works locally but when deployed there were missing beans and it kept on failing.
eventually i removed the jpa and defined the data source bean manually.

(note the System.getEnv is an additional hack since loading application.yaml isnt working as well - i opened a diff issue on that matter)

@Bean
    open fun dataSource(): DataSource {
        val hikariConfig = HikariConfig().apply {
            this.isAutoCommit = true
            this.driverClassName = "com.mysql.cj.jdbc.Driver"
            this.jdbcUrl = System.getenv()["MYSQL_HOST"]
            this.username = System.getenv()["MYSQL_USER"]
            this.password = System.getenv()["MYSQL_PASS"]
            this.connectionTimeout = 60000
            this.validationTimeout = 60000
            this.maximumPoolSize = 50
        }

        return HikariDataSource(hikariConfig)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions