Skip to content

Releases: 42BV/beanmapper-spring-boot-starter

3.1.1

02 Jul 12:04
Compare
Choose a tag to compare

A bug with a possible circular spring bean dependency was resolved in this release.
BeanMapper bean creation depended on the existence of an AuthenticationManager bean, this check resulted in a circular dependency because this spring-security bean will only be created untill WebMvcAutoConfiguration has been completed. And MergedFormConfig will be created during this step because it's a WebMvcConfigurer. To complete the cycle, MergedFormConfig depends on a BeanMapper bean.

v1.0.0

04 Oct 13:05
6dd3638
Compare
Choose a tag to compare
  • Strict handling of mappings; two layers of protection have been introduced. The first is the possibility to add annotations BeanMapToClass and BeanMapFromClass. These class will be registered together with their counterpart. The annotation-holder must have matching properties for all its valid properties. If properties are not matched, an exception will be thrown detailing the mismatches. The second layer of protection works on the Form/Result convention. It checks whether the source is consider a form Ie, classname has the suffix 'Form') or a target is a result (ie, classname has the suffix 'Result'). If this is the case, the other side must have matching properties as well. This second layer of defense works runtime right before the mapping takes place. Note that the suffix can be changed and the convention for strict mapping can be disabled.
  • Retain both pre-merged and merged entities; on using the MergedForm annotation, when the class MergePair is set as a result and when the annotation field mergePairClass is set, both the original and the target class will be preserved. This allows the developer to compare the before and after situation and react accordingly. One note that must be understood; the original is not the real original (as in; the exact instance found in the database), but is mapped by BeanMapper from the fetched entity to a new, similar entity. The reason for this is that the original instance is cached by Hibernate and will be reused by the target. It cannot be preserved.
  • MergedForm must be able to read from RequestPart; MergedForm can now read from multipart request bodies as well. When the annotation field multipart is set, the value is used to determine which part the content must be read from. Spring's RequestPartMethodArgumentResolver is reused for the process of actually reading the multipart form.
  • Bugfix; private fields were considered readable; BeanMapper contained an error that considered all fields (even private fields) as readable. This dormant error, previously seems not to have manifested itself, but with the strict handling of mappings it did. The fix has been to make sure to check the field modifiers for public access.