apache / apache/grails-core

Setup DataSource early to take advantage of AutoConfiguration

Open
#14,356 0 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Its looks to me like we can have an AutoConfiguration that will work with both Grails or Spring Boot/Micronaut.

- If we use AutoConfiguration to setup the DataSource early using the then all the other AutoConfiguration that depend on datasource can be taken advantage of.
- as it stands no in grails-plugin, its setup to late in the process for the other Autoconfigurations to get picked up
- grails HibernateDatastoreConnectionSourcesRegistrar.postProcessBeanDefinitionRegistry sets up the dataSource but checks for existing first.
- in order for other spring boot Autoconfigure (such as actuator metrics) to get picked up then datasource needs to be setup early.

so instead of using HibernateDatastoreSpringInitializer it can autoconfigure the dataSourceConnectionSourceFactory(CachedDataSourceConnectionSourceFactory)
and the Datasource early (which looks like it should be a factory based on dataSourceConnectionSourceFactory)

Contributor guide

Open the contributing guide

Research direction

Start by reading grails-plugin's HibernateDatastoreConnectionSourcesRegistrar and HibernateDatastoreSpringInitializer, along with CachedDataSourceConnectionSourceFactory. Trace when the DataSource and dataSourceConnectionSourceFactory are created relative to AutoConfiguration. Done means the DataSource is available early enough for other datasource-dependent AutoConfiguration while supporting Grails and Spring Boot/Micronaut.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, spring-boot
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.