Spring boot Mapstruct StackOverFlow Error

放肆的年华 提交于 2019-12-01 06:44:40

You have a cyclic dependency between VehicleType and Brand. You have 3 possibilities to resolve the cycles:

  1. One mapper will always ignore the cyclic field. I see that you have @JsonIgnore on the list of Brand in the VehicleType. You could ignore them via Mapping#ignore in your mapper.

  2. You will have explicit mappings that ignore what you don't need and use qualifiers to choose the appropriate methods. More info about qualifiers here in the documentation

  3. Use the latest release of 1.2.0 (at the time of answering 1.2.0.RC1 and use the new @Context parameter. Have a look at the mapping-with-cycles from the mapstruct examples repository. It solves cyclic mapping problems. You don't have to use Object, you can also use your specific types instead.

NOTE: The 1.2.0 release does not offer "out of the box" solving of cyclic mapping, it needs to be done by the users explicitly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!