package gaf3.core.jpa

import gaf3.core.jpa.web.GafJpaControllerAdvice
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import gaf3.core.jpa.web.reactive.GafJpaControllerAdvice as GafJpaReactiveControllerAdvice

@Configuration
class GafJpaConfiguration {

    @Bean
    @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
    fun jpaControllerAdvice(): GafJpaControllerAdvice {
        return GafJpaControllerAdvice()
    }

    @Bean
    @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
    fun jpaReactiveControllerAdvice(): GafJpaReactiveControllerAdvice {
        return GafJpaReactiveControllerAdvice()
    }
}

