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

main.lavalink.server.config.WebConfiguration.kt Maven / Gradle / Ivy

package lavalink.server.config

import dev.arbjerg.lavalink.api.RestInterceptor
import dev.arbjerg.lavalink.protocol.v4.json
import org.springframework.context.annotation.Configuration
import org.springframework.http.converter.HttpMessageConverter
import org.springframework.http.converter.StringHttpMessageConverter
import org.springframework.http.converter.json.KotlinSerializationJsonHttpMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
import org.springframework.web.servlet.config.annotation.EnableWebMvc
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer


@Configuration
@EnableWebMvc
class WebConfiguration(private val interceptors: List) : WebMvcConfigurer {

    override fun configureMessageConverters(converters: MutableList>) {
        converters.add(StringHttpMessageConverter())
        converters.add(KotlinSerializationJsonHttpMessageConverter(json))
        converters.add(MappingJackson2HttpMessageConverter())
    }

    override fun addInterceptors(registry: InterceptorRegistry) {
        interceptors.forEach { registry.addInterceptor(it) }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy