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

net.mossol.bot.context.AnnotatedServiceConfiguration Maven / Gradle / Ivy

package net.mossol.bot.context;

import javax.annotation.Resource;

import net.mossol.bot.controller.MossolMessageController;
import net.mossol.bot.controller.MossolLineController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.linecorp.armeria.spring.AnnotatedServiceRegistrationBean;
import com.linecorp.armeria.spring.ArmeriaServerConfigurator;

@Configuration
public class AnnotatedServiceConfiguration {

    @Resource
    MossolLineController mossolLineController;

    @Resource
    MossolMessageController mossolMessageController;

    @Bean
    public AnnotatedServiceRegistrationBean mossolHandler() {
        return new AnnotatedServiceRegistrationBean().setServiceName("MOSSOL")
                                                     .setPathPrefix("/")
                                                     .setService(mossolLineController);
    }

    @Bean
    public AnnotatedServiceRegistrationBean mossolMessageHandler() {
        return new AnnotatedServiceRegistrationBean().setServiceName("MOSSOL_MSG")
                                                     .setPathPrefix("/")
                                                     .setService(mossolMessageController);
    }

    @Bean
    public ArmeriaServerConfigurator armeriaServerConfigurator() {
        return serverBuilder ->
            serverBuilder.accessLogFormat("%h %l %u %t '%r' %s %b '%{X-Forwarded-For}i' '%{Referer}i'"
                                          + " '%{User-Agent}i' '%{Cookie}i'");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy