samedi 28 février 2015

Dozer + Spring: MappingException: Dozer Bean Mapper is already initialized

I am trying to implement Dozer as help for bridge pattern on my current webapp running Spring and Hibernate but I think I am doing something wrong, since trying to use a DozerBeanMapper instance more than once, will give me a MappingException.


Spring config:



@Configuration
public class AppConfig {
...
@Bean
public DozerBeanMapper dozerBeanMapper() {
return new DozerBeanMapper();
}
}


Usage:



@Service
public class FooService {
@Autowired private DozerBeanMapper mapper;

public void doSomething() {
mapper.map(foo, ImmutableFoo.class);
...
}


First time I call this service will work fine, but any further attempt to use it will result in an exception. Can someone please point what I am doing wrong?


Thanks.


Aucun commentaire:

Enregistrer un commentaire