Package org.springframework.beans.factory.support

Examples of org.springframework.beans.factory.support.GenericBeanDefinition


        Assert.notNull(controllerClass, "register controller bean class must not null");
        if (!WebApplicationContext.class.isAssignableFrom(ctx.getClass())) {
            throw new IllegalArgumentException("applicationContext must be WebApplicationContext type");
        }

        GenericBeanDefinition bd = new GenericBeanDefinition();
        bd.setBeanClass(controllerClass);

        String controllerBeanName = controllerClass.getName();
        removeOldControllerMapping(controllerBeanName);
        beanFactory.registerBeanDefinition(controllerBeanName, bd);
        addControllerMapping(controllerBeanName);
View Full Code Here


    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        DefaultListableBeanFactory dlbf = (DefaultListableBeanFactory) beanFactory;
        for (Class<?> daoClass : findMangoDaoClass()) {
            GenericBeanDefinition bf = new GenericBeanDefinition();
            bf.setBeanClassName(daoClass.getName());
            MutablePropertyValues pvs = bf.getPropertyValues();
            pvs.addPropertyValue("daoClass", daoClass);
            bf.setBeanClass(MangoBeanFactory.class);
            bf.setPropertyValues(pvs);
            bf.setLazyInit(false);
            dlbf.registerBeanDefinition(daoClass.getName(), bf);
        }
    }
View Full Code Here

    }

    private AbstractBeanDefinition createBeanDefinition(Object object, Class beanClass) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, object);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(Bean.Scope.SINGLETON.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
        beanDef.setConstructorArgumentValues(args);
        return beanDef;
    }
View Full Code Here

    private AbstractBeanDefinition createBeanDefinition(AccessibleObject access, Class beanClass, Bean.Scope scope) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, mycilaContext.getTest().getTarget());
        args.addIndexedArgumentValue(1, access);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(scope.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
        beanDef.setConstructorArgumentValues(args);
        return beanDef;
    }
View Full Code Here

    }

    private AbstractBeanDefinition createBeanDefinition(Object object, Class beanClass) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, object);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(Bean.Scope.SINGLETON.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
        beanDef.setConstructorArgumentValues(args);
        return beanDef;
    }
View Full Code Here

    private AbstractBeanDefinition createBeanDefinition(AccessibleObject access, Class beanClass, Bean.Scope scope) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, mycilaContext.introspector().instance());
        args.addIndexedArgumentValue(1, access);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(scope.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
        beanDef.setConstructorArgumentValues(args);
        return beanDef;
    }
View Full Code Here

        "Pre-existing context found associated to servlet class "
            + servletClass.getName() + " and servlet name "
            + servletName);

    childContext = new AnnotationConfigApplicationContext();
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClassName(handlerClassName);
    childContext.registerBeanDefinition(handlerClassName, beanDefinition);
    if (!kurentoApplicationContextExists()) {
      createKurentoApplicationContext(sc);
    }
    childContext.setParent(getKurentoApplicationContext());
View Full Code Here

  @Test
  public void systemPropertiesSecurityManager() {
    GenericApplicationContext ac = new GenericApplicationContext();
    AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);

    GenericBeanDefinition bd = new GenericBeanDefinition();
    bd.setBeanClass(TestBean.class);
    bd.getPropertyValues().add("country", "#{systemProperties.country}");
    ac.registerBeanDefinition("tb", bd);

    SecurityManager oldSecurityManager = System.getSecurityManager();
    try {
      System.setProperty("country", "NL");
View Full Code Here

  @Test
  public void stringConcatenationWithDebugLogging() {
    GenericApplicationContext ac = new GenericApplicationContext();
    AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);

    GenericBeanDefinition bd = new GenericBeanDefinition();
    bd.setBeanClass(String.class);
    bd.getConstructorArgumentValues().addGenericArgumentValue("test-#{ T(java.lang.System).currentTimeMillis() }");
    ac.registerBeanDefinition("str", bd);
    ac.refresh();

    String str = ac.getBean("str", String.class);
    assertTrue(str.startsWith("test-"));
View Full Code Here

  public void testIncompleteBeanDefinition() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    bpp.setBeanFactory(bf);
    bf.addBeanPostProcessor(bpp);
    bf.registerBeanDefinition("testBean", new GenericBeanDefinition());
    try {
      bf.getBean("testBean");
    }
    catch (BeanCreationException ex) {
      assertTrue(ex.getRootCause() instanceof IllegalStateException);
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.support.GenericBeanDefinition

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.