package net.frenopatico.citadels.modules;
import lombok.extern.java.Log;
import net.frenopatico.citadels.controller.IPlayersService;
import net.frenopatico.citadels.controller.annotations.Transactional;
import net.frenopatico.citadels.controller.impl.PlayersServiceImpl;
import net.frenopatico.citadels.controller.interceptors.TransactionalInterceptor;
import com.google.inject.AbstractModule;
import com.google.inject.matcher.Matchers;
import com.google.inject.servlet.ServletScopes;
/**
* Wire the services to the application.
*
*
* @author eduardo.ramirez.ronco@gmail.com
*
*/
@Log
public final class ServicesModule extends AbstractModule {
/**
* Avoid instantiation.
*
*/
private ServicesModule() {
super();
}
@Override
protected void configure() {
bind( IPlayersService.class ).to( PlayersServiceImpl.class ).in( ServletScopes.SESSION );
bindInterceptor( Matchers.any(), Matchers.annotatedWith( Transactional.class ), new TransactionalInterceptor() );
log.info( String.format( "%s initialized", ServicesModule.class.getSimpleName() ) );
}
/**
* Creates a new instance of the module.
*
* @return New instance of the module.
*/
public static ServicesModule build() {
return new ServicesModule();
}
}