All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ext.spring.PersistenceSpringFactory.kt Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version
package ext.spring

import ext.spring.model.RyoDomaiState
import org.ryoframework.core.domain.adapter.IDomainInfraConfig
import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.AutoConfigureOrder
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.Ordered
import javax.sql.DataSource

@Configuration
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
@ConditionalOnClass(DataSource::class, IDomainInfraConfig::class)
internal class PersistenceSpringFactory {

    companion object {
        private val logger = LoggerFactory.getLogger(PersistenceSpringFactory::class.java)
    }

    @Suppress("SpringJavaInjectionPointsAutowiringInspection")
    @Bean
    fun domainState(dataSource: DataSource, config: IDomainInfraConfig): RyoDomaiState {
        logger.info("Exécution des migrations base de données.")
        config.evolutions().apply(dataSource)
        logger.info("Migrations appliquées.")
        return RyoDomaiState()
    }



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy