orika-spring-boot-starter
orika-spring-boot-starter copied to clipboard
Use of --add-opens and it's consequence
@akkinoc @123Haynes If we want to use this library with Spring boot 3.0.x and Java 17 we need to add a vm option --add-opens, but that would yield a serious security consequence as any module can be accessed by any module, and encapsulation will loose it's presence, So how to overcome this? And Considering this what effects can possibly arise that code should handle.
@vanditshah99 orika has not seen any development in the past 2 years so I stopped maintaining my fork of the starter.
I recommend using another mapper like mapstruct that is better maintained for production systems.
It's quite easy to migrate to mapstruct from orika.
@123Haynes can you provide more details on how it is "quite easy to migrate to mapstruct from orika" please? I am unfamiliar with Mapstruct. Our organization has quite a large Orika footprint and since it seems dead we are looking at alternatives.
@sruffatti with mapstruct you need to define an interface for the mapper. Apart from that it handles pretty much like orika. See the "Mapstruct in 2 minutes" example at https://mapstruct.org/
You can also define one interface with several mappings. I defined one for each domain of my app for example to keep the migration effort manageable.
So for example for a spring project: Define an interface:
@Mapper(componentModel = "spring")
public interface DomainMapper {
DomainMapper INSTANCE = Mappers.getMapper(DomainMapper.class);
XmlResponse map(Response jsonResponse);
Domainobject1 map(jsonDomainobject1 jsonDomainobject1);
Domainobject2 map(XmlDomainobject2 xmlDomainobject2);
}
inject the Interface in your class and use it as you would use orika with
@Autowired
DomainMapper mapper;
[...]
Domainobject2 d2 = mapper.map(xmlDomainobject2)
you can use mapstruct and orika at the same time so you can easily migrate each mapping separately over some time before completely removing orika.
I added a note to README.md.
⚠️ Please note that Orika has not been maintained for a long time (orika-mapper/orika#372).
This issue is not active, so I will close it. If you still have problems, please open a new issue.