Пример #1
0
 @Bean
 public Mapper fooDozerBeanMapper() {
   DozerBeanMapper mapper = BeanMapper.getDozerBeanMapper();
   List<String> mappingFiles = new ArrayList(mapper.getMappingFiles());
   mappingFiles.add("foo-dozer-custom-convert.xml");
   mapper.setMappingFiles(mappingFiles);
   return mapper;
 }
 public void initDozer() {
   mapper = new DozerBeanMapper();
   List<String> myMappingFilesList = new ArrayList<String>();
   for (String mf : this.myMappingFiles) {
     myMappingFilesList.add(mf);
   }
   if (myMappingFilesList.isEmpty()) {
     // test if "dozerBeanMapping.xml" exists in classpath
     InputStream is =
         Thread.currentThread()
             .getContextClassLoader()
             .getResourceAsStream("dozerBeanMapping.xml");
     if (is != null)
       myMappingFilesList.add("dozerBeanMapping.xml"); // default dozer mapping file (if exists)
   }
   ((DozerBeanMapper) mapper).setMappingFiles(myMappingFilesList);
 }