https://kotlinlang.org logo
Title
a

Ayodele

08/29/2020, 9:10 AM
Hi guys I'm having issues with the mapstruct mapper in springboot
@Mapper
@Component
interface UserMapper {
    fun toUserDTO(user: User): UserDTO
    fun toListOfUserDTO(users: List<User>) : List<UserDTO>
    fun toUser(userDTO: UserDTO) : User
    fun toListOfUser(userDTOs: List<UserDTO>) : List<User>
}
and i'm using it in my contoller
@Autowired
lateinit var userMapper: UserMapper
It gives this error, please help
***************************
APPLICATION FAILED TO START *************************** Description: Field userMapper in com.scienta.backend_rated_ng.controller.AuthController required a bean of type 'com.scienta.backend_rated_ng.mapper.UserMapper' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.scienta.backend_rated_ng.mapper.UserMapper' in your configuration.
d

dave

08/29/2020, 9:11 AM
maybe #spring ?
a

Ayodele

08/29/2020, 9:12 AM
okay, thanks