Created
February 10, 2022 00:08
-
-
Save httpmurilo/8d651463987e9cf73daf19af9940e8c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.httpmurilo.sales.mapper; | |
import io.httpmurilo.sales.dto.UserDTO; | |
import io.httpmurilo.sales.entity.User; | |
import org.mapstruct.Mapper; | |
import org.mapstruct.factory.Mappers; | |
@Mapper(componentModel = "spring") //define que é um Spring bean e pode ser injetado via @Autowired | |
public abstract class UserMapper { //impedimos de instanciar diretamente | |
public static final UserMapper INSTANCE = Mappers.getMapper(UserMapper.class); //singleton | |
public abstract User toUser(UserDTO dto); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment