Issue
I'm trying to fix a circular dependency in a legacy project.
@Service
@Slf4j
public class FlowpathSubscriber {
@Autowired
@Qualifier("pubSubTemplate")
private PubSubTemplate pubSubTemplate;
@Autowired
private FlowpathBigQueryProcessor flowpathBigQueryProcessor;
@Value("${subscription}")
private String subscription;
@Autowired
private ObjectMapper objectMapper;
@Autowired
@Lazy
private SlackNotificationService slackNotificationService;
I added @Lazy
to SlackNotificationService
as it was causing a circular dependency issue. However adding @Lazy
causes an error during Gradle compilation:
error: cannot find symbol @Lazy
Solution
Add:
import org.springframework.context.annotation.Lazy;
Answered By - The Impaler
Answer Checked By - Gilberto Lyons (JavaFixing Admin)