Questions tagged [mapstruct]

MapStruct is a code generator for creating efficient, type-safe bean-to-bean mappings in Java.

MapStruct generates bean mapping code at compile time by means of a JSR 269 annotation processor.
The generated code is fast (no reflection or byte code generation at runtime), type-safe (code is generated from typed, domain-specific interfaces) and dependency-free.

Source Code

1447 questions
0
votes
1 answer

MapStruct generate code

I'm learning to use MapStruct according to reference guide. The eclipse verion is Eclipse Java EE IDE for Web Developers. Version: Kepler Service Release 2 pom.xml is as below just the same as the reference guide
H.Hao
  • 93
  • 2
  • 11
0
votes
1 answer

Weblogic 12c - Mapstruct - 1.0.0.Final - ClassNotFoundException: Cannot find implementation

I've been using mapstruct for a while now, but have found this problem while trying to deploy one of my webservices: Target state: deploy failed on Server my_server java.lang.ClassNotFoundException: Cannot find implementation for…
Edu Castrillon
  • 527
  • 1
  • 12
  • 28
0
votes
1 answer

mapstruct annotation processor did not generate mappers Implimentation

I have created a spring boot application using the jhipster generator, and then I added to entites author and book, author has many books while a book has one author. then when I run my app using Intellij IDEA I got this stacktrace…
Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191
0
votes
2 answers

MapStruct - How to specify generic type of an attribute?

Mapstruct can't find generic type of an attribute. Let's take an example to clarify what I'm trying to do. Considering the following dtos : class ListForm { private Collection adds; private Collection changes; private Collection
Clemzd
  • 895
  • 2
  • 15
  • 35
0
votes
1 answer

mapstruct ambiguous exception when using helper class

Using mapstruct v1.0.0.Final, I'm facing an ambiguous mapping exception trying to map from SourceType to TargetType: class TargetType { List children; boolean allResults; } class SourceType { List children; …
Edu Castrillon
  • 527
  • 1
  • 12
  • 28
0
votes
1 answer

Source and target share the same interface MapStruct

Hello I have the following problem using MapStruct, I have the next interfaces: public interface IRole { String getName(); void setName(String name); } public interface IUser { public String getUsername(); public void…
0
votes
2 answers

jhipster mapstruc relations

Hi I have a model in Jhipster with DTO mapstruct but I can´t correct mapping these relations Person -String name -... Address address Adress -String street -String zipCode the generator create the DTO with no relations PersonDTO …
-1
votes
0 answers

Issue with Using @Named Qualifier for Custom Mapping Method in MapStruct

I'm using MapStruct for object-to-object mapping in my Java project, and I'm trying to use a custom conversion method with the @Named qualifier. However, I'm encountering a "No method found annotated with @Named#value" error and can't seem to…
AlexeiP
  • 581
  • 1
  • 10
  • 26
-1
votes
0 answers

Spring-boot failed to start because of Mapstruct Mappers missing beans

I have an issue with Mapstruct, Maven compilation is successuful, the Mappers implementations are correctly generated in target folder as follow: But when spring-boot starts I get this error: (Not every time I run it it works sometimes) Error…
Amira
  • 3,184
  • 13
  • 60
  • 95
-1
votes
0 answers

Mapstruct generate two classes

Two implementation classesBuild.gradle IDEA Setting Gradle IDEA Setting Annotation Processors Although the project can be launched successfully, there might be errors in the IDE when generating the build files. How to remove one of they?
-1
votes
1 answer

What is the benefit of assigning a variable of a Mapper Instance to be static?

Let's suppose I have a Mapper Interface as follows: public interface SomeMapper { SomeMapper INSTANCE = Mappers.getMapper(SomeMapper.class); //Some Random Method public RandomResponse doSomething(); } And then I have an Executor…
RandomGuy
  • 1
  • 1
-1
votes
0 answers

How to make update mapping refer to an existing mappings?

PojoAlphabet has fields fieldA, fieldB,...,fieldZ. PojoNumber has fields field1, field2,...,field26. The Mappings is fieldA = field1, fieldB=field2,...,fieldZ=field26, I write a @Mappings on method PojoNumber toPojoNumber( PojoAlphabet alphabet )for…
ildvzg68472
  • 157
  • 1
  • 9
-1
votes
0 answers

Java, MapStruct, create a new instance from an mapper

I have below 2 objects: @Data public class AppleDto { private String field1; private String field2; } @Data public class AppleVo { private String fieldA; private AppleSnippet appleSnippet; } I hope that MapStruct generates…
ildvzg68472
  • 157
  • 1
  • 9
-1
votes
1 answer

Java annotation implementation logic

I want to know how Java generates annotation implementation like @Mapper and @FeignClient. Does It generates an implementation class in runtime? Thanks. Know how Java generates an implementation for an interface in runtime.
-1
votes
2 answers

JsonProperty.Access.READ_ONLY not working with nested objects (Jackson)

I am having some problems when using Jackson Access.READ_ONLY on a DTO inside another DTO. AuthorDTO.class AuthorDTO is the RequestBody on AuthorController post/put methods and it is also the ResponseEntity object. What I want is only show BookDTO…
jpl87
  • 11
  • 1