Package net.frenopatico.citadels.modules

Source Code of net.frenopatico.citadels.modules.ServicesModule

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();
    }
}
TOP

Related Classes of net.frenopatico.citadels.modules.ServicesModule

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.