Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.XmlBeanDefinitionReader


    private static final Class DEFAULT_PARSER_CLASS = CeltixXmlBeanDefinitionParser.class;
   
    private final PropertyEditor editor;

    CeltixXmlBeanFactory(Resource res) {
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this);
        reader.setParserClass(DEFAULT_PARSER_CLASS);
        reader.setEntityResolver(new CeltixBeansDtdResolver());
        reader.setValidating(false);
        reader.setNamespaceAware(true);
        reader.loadBeanDefinitions(res);
             
        editor = new JaxbPropertyEditor();
        registerCustomEditor(String.class, editor);
       
        PropertyEditor pe = null;
View Full Code Here


        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Creating Spring ApplicationContext from key : " + configKey);
        }
        GenericApplicationContext appContext = new GenericApplicationContext();
        XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(appContext);
        xbdr.setValidating(false);

        Object springConfig = synCtx.getEntry(configKey);
        if(springConfig == null) {
          String errorMessage = "Cannot look up Spring configuration " + configKey;
          log.error(errorMessage);
          throw new SynapseException(errorMessage);
        }

        xbdr.loadBeanDefinitions(
            new InputStreamResource(
                SynapseConfigUtils.getStreamSource(springConfig).getInputStream()));
        appContext.refresh();
        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Spring ApplicationContext from key : " + configKey + " created");
View Full Code Here


    static GenericApplicationContext getContext() {
        log.info("Creating Spring Application Context ...");
        GenericApplicationContext ctx = new GenericApplicationContext();
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
        reader.loadBeanDefinitions(new ClassPathResource("/applicationContext.xml"));

        ctx.refresh();
        return ctx;
    }
View Full Code Here

     */
    public static ApplicationContext getApplicationContext(List<String> additionalFilePathnames) {
        BusApplicationContext busApplicationContext = BusFactory.getDefaultBus()
            .getExtension(BusApplicationContext.class);
        GenericApplicationContext appContext = new GenericApplicationContext(busApplicationContext);
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
        List<URL> urls = ClassLoaderUtils.getResources("META-INF/cxf/java2wsbeans.xml",
                                                       SpringServiceBuilderFactory.class);
        for (URL url : urls) {
            reader.loadBeanDefinitions(new UrlResource(url));
        }
       
        for (String pathname : additionalFilePathnames) {
            try {
                reader.loadBeanDefinitions(new FileSystemResource(pathname));
            } catch (BeanDefinitionStoreException bdse) {
                throw new ToolException("Unable to open bean definition file " + pathname, bdse.getCause());
            }
        }
        appContext.refresh();
View Full Code Here

            new PluggableSchemaResolver(cl)));
    }
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
            // Create a new XmlBeanDefinitionReader for the given BeanFactory.
        XmlBeanDefinitionReader beanDefinitionReader =
            new ControlledValidationXmlBeanDefinitionReader(beanFactory);
        beanDefinitionReader.setNamespaceHandlerResolver(nsHandlerResolver);
       
        // Configure the bean definition reader with this context's
        // resource loading environment.
        beanDefinitionReader.setResourceLoader(this);
        beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));

        // Allow a subclass to provide custom initialization of the reader,
        // then proceed with actually loading the bean definitions.
        initBeanDefinitionReader(beanDefinitionReader);
        loadBeanDefinitions(beanDefinitionReader);
View Full Code Here

    _appClassLoader=new URLClassLoader(urls, _classLoader);

    // delegate work to Spring framework...
    _factory=new GeronimoBeanFactory();
    XmlBeanDefinitionReader xbdr=new XmlBeanDefinitionReader(_factory);
    xbdr.setBeanClassLoader(_appClassLoader);
    xbdr.loadBeanDefinitions(new ClassPathResource(_configPath.toString(), _appClassLoader));

    // install aspects around Spring Bean initialisation...
    _factory.addBeanPostProcessor(new BeanPostProcessor() {
       public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
         return beforeInitialization(bean, name);
View Full Code Here

            // create generic application context
            GenericApplicationContext context = new GenericApplicationContext(parent);
            context.setClassLoader(classLoader);
            ResourceLoader resourceLoader = new DefaultResourceLoader(classLoader);
            context.setResourceLoader(resourceLoader);
            BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
            for (String resource : resources) {
                reader.loadBeanDefinitions(resourceLoader.getResource(resource));
            }
            context.refresh();
            return context;
        }
View Full Code Here

   */
  @Test
  public void registersJackson2InitializerCorrectly() {

    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
    reader.loadBeanDefinitions(getPopulatorResource());

    BeanDefinition definition = beanFactory.getBeanDefinition("jackson2-populator");
    assertThat(definition, is(notNullValue()));

    Object bean = beanFactory.getBean("jackson2-populator");
View Full Code Here

   */
  @Test
  public void registersXmlInitializerCorrectly() {

    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
    reader.loadBeanDefinitions(getPopulatorResource());

    BeanDefinition definition = beanFactory.getBeanDefinition("xml-populator");
    assertThat(definition, is(notNullValue()));

    Object bean = beanFactory.getBean("xml-populator");
View Full Code Here

  BeanDefinitionReader reader;

  @Before
  public void setUp() {
    factory = new DefaultListableBeanFactory();
    reader = new XmlBeanDefinitionReader(factory);
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.XmlBeanDefinitionReader

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.