Package com.foreach.across.core.context.beans

Examples of com.foreach.across.core.context.beans.PrimarySingletonBean


      config.getInstallers().addAll( Arrays.asList( module.getInstallers() ) );

      // Provide the current module beans
      Map<String, Object> providedSingletons = new HashMap<>();
      providedSingletons.put( AcrossModule.CURRENT_MODULE + "Info",
                              new PrimarySingletonBean(
                                  moduleInfo,
                                  new AutowireCandidateQualifier( Module.class.getName(),
                                                                  AcrossModule.CURRENT_MODULE )
                              )
      );
      providedSingletons.put( AcrossModule.CURRENT_MODULE,
                              new PrimarySingletonBean(
                                  module,
                                  new AutowireCandidateQualifier( Module.class.getName(),
                                                                  AcrossModule.CURRENT_MODULE )
                              )
      );
      providedSingletons.put( AcrossModule.CURRENT_MODULE + "Settings",
                              new PrimarySingletonBean(
                                  moduleInfo.getSettings(),
                                  new AutowireCandidateQualifier( Module.class.getName(),
                                                                  AcrossModule.CURRENT_MODULE )
                              )
      );
View Full Code Here


    ProvidedBeansMap providedBeans = new ProvidedBeansMap();

    // Create the AcrossContextBeanRegistry
    AcrossContextBeanRegistry contextBeanRegistry = new DefaultAcrossContextBeanRegistry( contextInfo );
    providedBeans.put( contextBeanRegistry.getFactoryName(),
                       new PrimarySingletonBean(
                           new DefaultAcrossContextBeanRegistry( contextInfo ),
                           new AutowireCandidateQualifier( Qualifier.class.getName(),
                                                           AcrossContextBeanRegistry.BEAN )
                       ) );

    // Put the context and its info as fixed singletons
    providedBeans.put( AcrossContext.BEAN, new PrimarySingletonBean( context ) );
    providedBeans.put( AcrossContextInfo.BEAN, new PrimarySingletonBean( contextInfo ) );

    // Put the module info as singletons in the context
    for ( AcrossModuleInfo moduleInfo : contextInfo.getConfiguredModules() ) {
      // Create the module instances as primary beans so they do not clash with modules
      // configured as beans in a parent application context
      providedBeans.put( "across.module." + moduleInfo.getName(),
                         new PrimarySingletonBean(
                             moduleInfo.getModule(),
                             new AutowireCandidateQualifier( Module.class.getName(),
                                                             moduleInfo.getName() )
                         )
      );
View Full Code Here

  public SingletonBeanConfigurer( String beanName, Object value ) {
    this( beanName, value, false );
  }

  public SingletonBeanConfigurer( String beanName, Object value, boolean makePrimary ) {
    addBean( beanName, makePrimary ? new PrimarySingletonBean( value ) : new SingletonBean( value ) );
  }
View Full Code Here

  @Test
  public void primarySingletons() {
    String one = "one";

    beans.put( "two", new PrimarySingletonBean( one ) );
    Map<String, Object> singletons = beans.getSingletons();
    assertEquals( 1, singletons.size() );
    assertSame( one, singletons.get( "two" ) );

    Map<String, BeanDefinition> definitions = beans.getBeanDefinitions();
View Full Code Here

    BeanDefinition defFive = mock( BeanDefinition.class );
    BeanDefinition defFour = new GenericBeanDefinition();

    beans.put( "one", one );
    beans.put( "two", new SingletonBean( two ) );
    beans.put( "three", new PrimarySingletonBean( three ) );
    beans.put( "four", new SingletonBean( four, defFour ) );
    beans.put( "five", defFive );

    Map<String, Object> singletons = beans.getSingletons();
    assertEquals( 4, singletons.size() );
View Full Code Here

TOP

Related Classes of com.foreach.across.core.context.beans.PrimarySingletonBean

Copyright © 2018 www.massapicom. 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.