'Not able to import @Value in springboot in Response class

for some reason I'm not able to import org.springframework.beans.factory.annotation.Value in my response class but I am able to in my controller class

Down below is my response class

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.beans.factory.annotation.Value;


import java.math.BigDecimal;
import java.time.Year;

@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class PreliminaryResponse extends MemberEventResponse {

    @Schema(description = "current year pension earnings ")
    private Year year;

    @Value( "CFT")
    @Schema(description = "status info ")
    private String status;

    @Schema(description = "period of months ")
    private Double service;

    @Schema(description = "earnings info ")
    private BigDecimal earnings;

    private BigDecimal retroToThisYear;

    @Schema(description = "if earnings is overridden ")
    private Boolean override;

    @Schema(description = "overrideValue info ")
    private BigDecimal overrideValue;

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source