{"id":27870337,"url":"https://github.com/devholic22/fcm-introduce-spring","last_synced_at":"2025-05-04T23:15:25.221Z","repository":{"id":250824351,"uuid":"835582064","full_name":"devholic22/fcm-introduce-spring","owner":"devholic22","description":"FCM 알림 적용 방법 - 스프링 코드 리포지터리입니다. (24.07)","archived":false,"fork":false,"pushed_at":"2024-08-01T13:21:31.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-04T23:15:18.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devholic22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-30T06:11:25.000Z","updated_at":"2024-08-01T13:21:34.000Z","dependencies_parsed_at":"2024-07-30T14:28:14.641Z","dependency_job_id":null,"html_url":"https://github.com/devholic22/fcm-introduce-spring","commit_stats":null,"previous_names":["devholic22/fcm-introduce","devholic22/fcm-introduce-spring"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devholic22%2Ffcm-introduce-spring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devholic22%2Ffcm-introduce-spring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devholic22%2Ffcm-introduce-spring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devholic22%2Ffcm-introduce-spring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devholic22","download_url":"https://codeload.github.com/devholic22/fcm-introduce-spring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252411852,"owners_count":21743613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-04T23:15:24.580Z","updated_at":"2025-05-04T23:15:25.215Z","avatar_url":"https://github.com/devholic22.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fcm-introduce-spring\n본 리포지터리는 블로그 내용을 쉽게 실습하실 수 있도록 스프링 환경에서의 FCM 알림 기능 구현 코드를 담은 리포지터리입니다.\n\n## 적용한 기술 환경\n* Spring Boot 3.3.2\n* Java 17\n* Spring Data JPA 3.3.2\n* Hibernate 6.5.2\n* Spring Data Redis 3.3.2\n* Spring Web 3.3.2\n* Lombok 1.18.34\n* MySQL 8.3.0\n* FCM (firebase-admin) 9.3.0\n\n## 주의사항\n### 1. 파이어베이스 파일이 필요합니다.\n샘플 코드에는 firebase.json 파일을 보관해두지 않았습니다.  \n블로그 글을 참고하여 파이어베이스 파일을 받은 뒤 `src/main/resources/firebase.json`으로 저장해주시기 바랍니다.\n### 2. 파이어베이스 토큰이 필요합니다.\n샘플 코드에는 파이어베이스 토큰을 아래처럼 작성해두었기 때문에 제대로 실행되지 않습니다.  \n블로그 글을 참고하여 토큰을 발급받은 뒤 대체하시기 바랍니다.\n```java\n@RequiredArgsConstructor\n@Transactional\n@Service\npublic class AlertService {\n\n    private static final String TOKEN = \"...\"; // 실제 FCM 토큰으로 테스트 해 보시면 됩니다.\n\n    private final AlertRepository alertRepository;\n    private final AlertTokenRepository tokenRepository;\n    private final AlertManager alertManager;\n\n    // 토큰 저장\n    public void saveToken(final Long id, final String token) {\n        tokenRepository.saveToken(id, token);\n    }\n\n    // 알림 전송\n    public void sendAlert(final String title, final String body, final String sender, final Long receiverId) {\n        // String token = tokenRepository.getToken(receiverId); 프로젝트에서는 레디스를 이용해서 토큰을 조회합니다.\n        Alert alert = Alert.createWith(title, body, receiverId);\n        Alert savedAlert = alertRepository.save(alert);\n        alertManager.send(savedAlert, sender, TOKEN);\n    }\n}\n```\n## 참고 링크 (블로그 글, Pull Request)\n* [[ATWOZ] FCM 알림 기능 개발 기록기 (1) - FCM 도입 이유와 아키텍처 구조](https://devwriter.tistory.com/49)\n* [[ATWOZ] FCM 알림 기능 개발 기록기 (2) - FCM 토큰 관리 방법 및 스프링 코드 설명](https://devwriter.tistory.com/50)\n* [[ATWOZ] FCM 알림 기능 개발 기록기 (3) - 안드로이드 에뮬레이터로 알림 검증하기](https://devwriter.tistory.com/51)\n* [프로젝트 FCM 기능 적용 Pull Request](https://github.com/sosow0212/atwoz/pull/41)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevholic22%2Ffcm-introduce-spring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevholic22%2Ffcm-introduce-spring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevholic22%2Ffcm-introduce-spring/lists"}