Examples of containsBean()


Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.containsBean()

    assertEquals(null, lbf.getType("&x1"));
    assertFalse(TestBeanFactory.initialized);

    lbf.registerAlias("x1", "x2");
    assertTrue(lbf.containsBean("x2"));
    assertFalse(lbf.containsBean("&x2"));
    assertTrue(lbf.containsLocalBean("x2"));
    assertFalse(lbf.containsLocalBean("&x2"));
    assertFalse(lbf.isSingleton("x2"));
    assertFalse(lbf.isSingleton("&x2"));
    assertTrue(lbf.isPrototype("x2"));
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.containsBean()

    bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    lbf.registerBeanDefinition("test", bd);
    Object singletonObject = new TestBean();
    lbf.registerSingleton("singletonObject", singletonObject);

    assertTrue(lbf.containsBean("singletonObject"));
    assertTrue(lbf.isSingleton("singletonObject"));
    assertEquals(TestBean.class, lbf.getType("singletonObject"));
    assertEquals(0, lbf.getAliases("singletonObject").length);
    DependenciesBean test = (DependenciesBean) lbf.getBean("test");
    assertEquals(singletonObject, lbf.getBean("singletonObject"));
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.containsBean()

    Object[] friends = hasInnerBeans.getFriends().toArray();
    assertEquals(3, friends.length);
    DerivedTestBean inner2 = (DerivedTestBean) friends[0];
    assertEquals("inner2", inner2.getName());
    assertTrue(inner2.getBeanName().startsWith(DerivedTestBean.class.getName()));
    assertFalse(xbf.containsBean("innerBean#1"));
    assertNotNull(inner2);
    assertEquals(7, inner2.getAge());
    TestBean innerFactory = (TestBean) friends[1];
    assertEquals(DummyFactory.SINGLETON_NAME, innerFactory.getName());
    TestBean inner5 = (TestBean) friends[2];
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.containsBean()

            server = new FtpServer();
        }
        else if( args.length == 2 ) {
            LOG.info("Using xml configuration file " + args[1] + "...");
            XmlBeanFactory bf = new XmlBeanFactory(new FileSystemResource(args[1]));
            if(bf.containsBean("server")) {
                server = (FtpServer) bf.getBean("server");
            } else {
                String[] beanNames = bf.getBeanNamesForType(FtpServer.class);
                if(beanNames.length == 1) {
                    server = (FtpServer) bf.getBean(beanNames[0]);
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.containsBean()

        } else if( (args.length == 1) && args[0].equals("-?") ) {
            usage();
        } else if( args.length == 1 ) {
            System.out.println("Using XML configuration file " + args[0] + "...");
            XmlBeanFactory bf = new XmlBeanFactory(new FileSystemResource(args[0]));
            if(bf.containsBean("server")) {
                server = (FtpServer) bf.getBean("server");
            } else {
                String[] beanNames = bf.getBeanNamesForType(FtpServer.class);
                if(beanNames.length == 1) {
                    server = (FtpServer) bf.getBean(beanNames[0]);
View Full Code Here

Examples of org.springframework.context.ApplicationContext.containsBean()

        final ApplicationContext ctx = ((ConfigurableApplicationContext) schedulerContext.get("applicationContext"));

        // Try to re-create job bean from underlying task (useful for managing
        // failover scenarios)
        if (!ctx.containsBean(bundle.getJobDetail().getKey().getName())) {
            Long taskId = JobInstanceLoader.getTaskIdFromJobName(bundle.getJobDetail().getKey().getName());
            if (taskId != null) {
                TaskDAO taskDAO = ctx.getBean(TaskDAO.class);
                SchedTask task = taskDAO.find(taskId);
View Full Code Here

Examples of org.springframework.context.ApplicationContext.containsBean()

     * @see ClassUtils#getShortNameAsProperty(Class)
     */
    protected Object getServiceForClassType(Class serviceType) {
        String lookupName = ClassUtils.getShortNameAsProperty(serviceType);
        ApplicationContext ctx = getApplicationContext();
        if (ctx.containsBean(lookupName)) {
            Object bean = ctx.getBean(lookupName);
            if (serviceType.isAssignableFrom(bean.getClass())) {
                if(logger.isDebugEnabled()) {
                    logger.debug("Using bean '" + lookupName + "' (" + bean.getClass().getName() + ") for service " + serviceType.getName());
                }
View Full Code Here

Examples of org.springframework.context.ApplicationContext.containsBean()

        directoryProvider = (DirectoryProvider) appContext.getBean("directoryProvider", DirectoryProvider.class);
        alertProvider = (AlertProvider) appContext.getBean("alertProvider", AlertProvider.class);
        dataSourceProvider = (DataSourceProvider) appContext.getBean("dataSourceProvider", DataSourceProvider.class);
        propertiesProvider = (PropertiesProvider) appContext.getBean("propertiesProvider", PropertiesProvider.class);
       
        if (appContext.containsBean("scheduledReportCallbacks"))
        {
          callbacks = (List<ScheduledReportCallback>) appContext.getBean("scheduledReportCallbacks", List.class);
        }
       
        return appContext;
View Full Code Here

Examples of org.springframework.context.ApplicationContext.containsBean()

     */
    static class ContextHolder
    {
        public static IFolderLabelPolicy getLabelPolicy() {
            final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext();
            if (applicationContext.containsBean(FOLDER_LABEL_POLICY)) {
                final IFolderLabelPolicy folderLabelPolicy = (IFolderLabelPolicy)applicationContext.getBean(FOLDER_LABEL_POLICY, IFolderLabelPolicy.class);
                return folderLabelPolicy;
            }

            return null;
View Full Code Here

Examples of org.springframework.context.ConfigurableApplicationContext.containsBean()

        DefaultListableBeanFactory factory = (DefaultListableBeanFactory) ctx
            .getBeanFactory();
        Class actionClass = getActionClass(modelName);
        String managerBeanName = getManagerBeanName(modelName);

        if (!ctx.containsBean(managerBeanName)) {
          Class managerClass = getManagerClass(modelName);
          if (managerClass != null) {
            RootBeanDefinition rbd = new RootBeanDefinition();
            rbd.setBeanClass(managerClass);
            rbd.getPropertyValues().addPropertyValue(daoProperty,
View Full Code Here
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.