빈 등록이 필수가 아닌데 final로 빈을 등록하고 있었다!!
그래서 @Autowired(required = false)를 주었다. 이후 null 체크를 하여 코드를 진행하였다.
@Autowired(required = false)
private SlackNotifier slackNotifier;
if(slackNotifier != null) {
// Slack으로 에러 알림 전송
slackNotifier.sendErrorNotification(
"서버 에러 발생 (500 Internal Server Error)",
e.getMessage() != null ? e.getMessage() : "알 수 없는 서버 에러가 발생했습니다.",
e
);
}
'개발이 좋아서 > Troubleshooting이 좋아서' 카테고리의 다른 글
cors 에러 문제 - trim을 안했다.. (0) | 2025.03.03 |
---|---|
@WithCustomMockUser - 테스트 코드 작성 시 인증 (0) | 2025.02.24 |
There were failing tests. See the report at: file:///C:/repository/ 프로젝트/build/reports/tests/test/index.html (0) | 2025.02.17 |