| 
01 /*02  * Copyright 2008-2015 the original author or authors.
 03  *
 04  * Licensed under the Apache License, Version 2.0 (the "License");
 05  * you may not use this file except in compliance with the License.
 06  * You may obtain a copy of the License at
 07  *
 08  *     http://www.apache.org/licenses/LICENSE-2.0
 09  *
 10  * Unless required by applicable law or agreed to in writing, software
 11  * distributed under the License is distributed on an "AS IS" BASIS,
 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  * See the License for the specific language governing permissions and
 14  * limitations under the License.
 15  */
 16 package org.codehaus.griffon.runtime.groovy;
 17
 18 import griffon.builder.core.CoreBuilderCustomizer;
 19 import griffon.core.addon.GriffonAddon;
 20 import griffon.core.injection.Module;
 21 import griffon.core.mvc.MVCGroupManager;
 22 import griffon.util.BuilderCustomizer;
 23 import griffon.util.CompositeResourceBundleBuilder;
 24 import griffon.util.ConfigReader;
 25 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
 26 import org.codehaus.griffon.runtime.groovy.mvc.GroovyAwareMVCGroupManager;
 27 import org.codehaus.griffon.runtime.groovy.util.GroovyAwareCompositeResourceBundleBuilder;
 28 import org.kordamp.jipsy.ServiceProviderFor;
 29
 30 import javax.inject.Named;
 31
 32 /**
 33  * @author Andres Almiray
 34  * @since 2.0.0
 35  */
 36 @Named("groovy")
 37 @ServiceProviderFor(Module.class)
 38 public class GroovyModule extends AbstractModule {
 39     @Override
 40     protected void doConfigure() {
 41         // tag::bindings[]
 42         bind(ConfigReader.class)
 43             .toProvider(ConfigReader.Provider.class)
 44             .asSingleton();
 45
 46         bind(CompositeResourceBundleBuilder.class)
 47             .to(GroovyAwareCompositeResourceBundleBuilder.class)
 48             .asSingleton();
 49
 50         bind(GriffonAddon.class)
 51             .to(GroovyAddon.class)
 52             .asSingleton();
 53
 54         bind(MVCGroupManager.class)
 55             .to(GroovyAwareMVCGroupManager.class)
 56             .asSingleton();
 57
 58         bind(BuilderCustomizer.class)
 59             .to(CoreBuilderCustomizer.class)
 60             .asSingleton();
 61         // end::bindings[]
 62     }
 63 }
 |