Open GoogleCodeExporter opened 8 years ago
I have the same problem.
Original comment by ja...@jirutka.cz
on 17 Apr 2014 at 6:38
Still no response from developers? :( I’m still stuck on 1.4.4, but I’ve
just ran into another bug which is already fixed in 1.4.5, but can’t update
because of this bug.
Original comment by ja...@jirutka.cz
on 13 May 2014 at 6:15
[deleted comment]
Any progress? :)
Original comment by ja...@jirutka.cz
on 23 May 2014 at 2:17
Hello have the same problem with the spring integration:
Source:
@Component
public class SpringAwareBeanMapper extends ConfigurableMapper implements
ApplicationContextAware {
private static Log logger = LogFactory.getLog(SpringAwareBeanMapper.class);
private MapperFactory factory;
/**
* {@inheritDoc}
*/
@Override
protected void configureFactoryBuilder(final DefaultMapperFactory.Builder factoryBuilder) {
// customize the factoryBuilder as needed
}
/**
* {@inheritDoc}
*/
@Override
protected void configure(final MapperFactory factory) {
this.factory = factory;
// customize the factory as needed
}
/**
* {@inheritDoc}
*/
@Override
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
addAllSpringBeans(applicationContext);
}
/**
* Adds all managed beans of type {@link Mapper} or {@link Converter} to the parent {@link MapperFactory}.
*
* @param applicationContext The application context to look for managed beans in.
*/
@SuppressWarnings("rawtypes")
private void addAllSpringBeans(final ApplicationContext applicationContext) {
final Map<String, Converter> converters = applicationContext.getBeansOfType(Converter.class);
for (final Converter<?, ?> converter : converters.values()) {
addConverter(converter);
}
final Map<String, Mapper> mappers = applicationContext.getBeansOfType(Mapper.class);
for (final Mapper<?, ?> mapper : mappers.values()) {
addMapper(mapper);
}
}
/**
* Add a {@link Converter}.
*
* @param converter The converter.
*/
public void addConverter(final Converter<?, ?> converter) {
if (logger.isDebugEnabled())
{
logger.debug("Add converter to factory: " + converter);
}
factory.getConverterFactory().registerConverter(converter);
}
/**
* Add a {@link Mapper}.
*
* @param mapper The mapper.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addMapper(final Mapper<?, ?> mapper) {
if (logger.isDebugEnabled())
{
logger.debug("Add mapper to factory: " + mapper);
}
factory.classMap(mapper.getAType(), mapper.getBType())
.byDefault()
.customize((Mapper) mapper)
.register();
}
}
Error:
Caused by: java.lang.IllegalStateException: Cannot register converters after
MapperFacade has been initialized
......
Thanks.
Original comment by marco.ro...@gmail.com
on 1 Jul 2014 at 3:42
Hi,
I also have this issue. Is there any progress on it?
Thanks.
Original comment by carine.l...@gmail.com
on 1 Oct 2014 at 8:39
Hi, I see the lot of changes related to Converters in branch
https://github.com/orika-mapper/orika/tree/orangina
Probably the issue has fixed in this branch.
Can somebody confirm this? I mean developers.
Also, as source code migrated to github, will be great to have enabled issues
on github as well.
Thank you. very appreciate your work on this library.
Original comment by vladymyr...@gmail.com
on 3 Jan 2015 at 7:29
Original issue reported on code.google.com by
hielke.hoeve
on 25 Mar 2014 at 9:34