Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.CustomEditorConfigurer


    public static void main(String[] args) {
        ConfigurableListableBeanFactory factory = new XmlBeanFactory(
                new FileSystemResource("./ch5/src/conf/pe/custom.xml"));

        CustomEditorConfigurer config = (CustomEditorConfigurer) factory
                .getBean("customEditorConfigurer");

        config.postProcessBeanFactory(factory);

        CustomEditorExample bean = (CustomEditorExample) factory
                .getBean("exampleBean");

        System.out.println(bean.getMatchCount());
View Full Code Here


  public static XmlBeanFactory loadBeanFactory(Resource r) {
    XmlBeanFactory beanFactory = new XmlBeanFactory(r);
   
    try {
      if (beanFactory.containsBean("customEditorConfigurer")) {
        CustomEditorConfigurer configurer = (CustomEditorConfigurer) beanFactory.getBean("customEditorConfigurer");   
        configurer.postProcessBeanFactory(beanFactory);
      }
    } catch (NoSuchBeanDefinitionException nsbde) {
      throw new RuntimeException(nsbde);
    }

    Map<Class, PropertyEditor> map = new HashMap<Class, PropertyEditor>();
    map.put(ColourPair.class, new ColourPairPropertyEditor());
    map.put(Color.class, new ColourPropertyEditor());
    map.put(Pattern.class, new PatternPropertyEditor());
    map.put(DateFormat.class, new DateFormatPropertyEditor());
    map.put(ColumnWidths.class, new ColumnWidthsPropertyEditor());

    CustomEditorConfigurer configurer = new CustomEditorConfigurer();
    configurer.setCustomEditors(map)
    configurer.postProcessBeanFactory(beanFactory);
    return beanFactory;
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.CustomEditorConfigurer

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.