So I have a mapstruct
mapper in my app, which has source to destination pojo mappings. I perform some logic inside the @AfterMapping
class using the value from the @Value
like below. But it seems like the value is not being fetched and hence its set as null
What am I missing here?
@Mapper
abstract class Student{
@Value("${spring.application.name}")
String appName;
abstract StudentModel convert(StudentDTO Studentdto);
@AfterMapping
void postConvert(@MappingTarget StudentModel studentmodel,StudentDTO studentDTO) {
studentmodel.setName(appName)
}
application.yml
spring:
application:
name: ABC