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

com.github.zhengframework.web.WebModule Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package com.github.zhengframework.web;

import com.github.zhengframework.configuration.ConfigurationAwareServletModule;
import com.github.zhengframework.configuration.ConfigurationBeanMapper;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.OptionalBinder;
import java.util.Map;
import javax.websocket.server.ServerEndpointConfig;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;


@Slf4j
@EqualsAndHashCode(callSuper = false, of = {})
public class WebModule extends ConfigurationAwareServletModule {

  @Override
  protected void configureServlets() {
    Map configMap = ConfigurationBeanMapper
        .resolve(getConfiguration(), WebConfig.class);
    WebConfig webConfig = configMap.getOrDefault("", new WebConfig());
    bind(WebConfig.class).toInstance(webConfig);
    OptionalBinder
        .newOptionalBinder(binder(), new TypeLiteral() {
        });
    OptionalBinder.newOptionalBinder(binder(), new TypeLiteral() {
    });
    requireBinding(WebServer.class);
    bind(WebServerService.class).asEagerSingleton();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy