[Spring/Security] Firebase๋ฅผ ํ™œ์šฉํ•œ ์ธ์ฆ ๊ตฌํ˜„
ยท
Backend/Spring Boot
ํ”„๋กœ์ ํŠธ์˜ ์ด์ „ ๋ฒ„์ „์—๋Š” ๋”ฐ๋กœ ๋ฐฑ์—”๋“œ ์„œ๋ฒ„๊ฐ€ ์—†์—ˆ๊ณ , React Native์—์„œ Firebase๋ฅผ ์ด์šฉํ•ด ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. ๋‚˜๋Š” ์ดํ›„ ํ”„๋กœ์ ํŠธ์— ํ•ฉ๋ฅ˜ํ•ด Spring์œผ๋กœ ๋‹ค๋ฅธ ์„œ๋ฒ„๋ฅผ ๊ฐœ๋ฐœํ•˜๊ณ  ์žˆ๋‹ค. ๋ฐฑ์—”๋“œ์—์„œ๋„ ์‚ฌ์šฉ์ž๋ฅผ ์‹๋ณ„ํ•˜๊ธฐ ์œ„ํ•ด Firebase๋กœ ๋ฐœ๊ธ‰๋œ ํ† ํฐ์„ ์‚ฌ์šฉํ•ด์•ผ ํ–ˆ๋‹ค.  ๊ตฌํ˜„์„ ์œ„ํ•ด Firebase Token์— ๋Œ€ํ•ด ์ดํ•ดํ•˜๋Š” ๊ณผ์ •์ด ํ•„์š”ํ–ˆ๊ณ , ํ† ํฐ์„ ๋‹ค๋ฃจ๊ธฐ ์œ„ํ•ด Spring Security๋„ ๊ณต๋ถ€ํ•ด์•ผ ๋๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ตœ์ข…์ ์œผ๋กœ firebase๊ฐ€ ํฌํ•จ๋œ ์„œ๋ฒ„๋ฅผ ๋ฐฐํฌํ•˜๊ธฐ๊นŒ์ง€ ๋งŽ์€ ์‚ฝ์งˆ์„ ํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค. ๊ตฌํ˜„ํ•˜๋ฉด์„œ ๊ณต๋ถ€ํ–ˆ๋˜ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜๊ณ , ๊ตฌํ˜„ ๊ณผ์ •์„ ๊ณต์œ ํ•˜๊ณ ์ž ํ•œ๋‹ค!     Firebase Token? ์šฐ์„  Firebase Token์— ๋Œ€ํ•ด ์•Œ์•„์•ผ ํ•œ๋‹ค. Firebase Authe..
[Spring/JUnit] Mock ๊ฐ์ฒด ์„ค์ • ๋ฌธ์ œ : java.lang.AssertionError: Expecting actual not to be null
ยท
Backend/Spring Boot
โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€java.lang.AssertionError: Expecting actual not to be null     ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : Spring Boot `3.2.3`DB : MySQL(๋กœ์ปฌ), H2(ํ…Œ์ŠคํŠธ)Library : JPA, QueryDSL `5.0.0`Test : JUnit     ๐Ÿ”Ž ์›์ธSpring์—์„œ Junit์œผ๋กœ Service ๋‹จ์˜ ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก ๊ธฐ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก ๋ฉ”์†Œ๋“œ๋Š” `save()`๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ณ , ์ƒˆ๋กœ ๋“ฑ๋ก๋œ ๊ฒŒ์‹œ๊ธ€์˜ `id`๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์ด๋ฅผ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์œ„ํ•ด Mock ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์–ด `save()`๋ฅผ ์ˆ˜ํ–‰ํ•˜๋ฉด ๋ฐ˜ํ™˜ํ•˜๋„๋ก ํ–ˆ๊ณ , `getId()`๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด `id`๋กœ 1L์„ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก ๋ฉ”์†Œ๋“œ๋ฅผ ์‹คํ–‰ํ–ˆ์„..
[Spring/JUnit] H2 ์˜ˆ์•ฝ์–ด user ๋•Œ๋ฌธ์— ๋ฐœ์ƒ : Error executing DDL "drop table if exists user cascade " via JDBC [Syntax error in SQL statement "drop table if exists [*]user cascade "; expected "identifier";]
ยท
Backend/Spring Boot
โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€Error executing DDL "drop table if exists user cascade " via JDBC [Syntax error in SQL statement "drop table if exists [*]user cascade "; expected "identifier";]     ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : Spring Boot`3.2.3`DB : MySQL(๋กœ์ปฌ), H2(ํ…Œ์ŠคํŠธ)Library : JPA, QueryDSL`5.0.0`Test : JUnit     ๐Ÿ”Ž ์›์ธSpring์—์„œ JPA Repository ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.DB๋Š” ๋กœ์ปฌ์—์„œ ๊ฐœ๋ฐœ์„ ์œ„ํ•ด MySQL์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€๋งŒ, ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด์„œ ๋‚ด์žฅํ˜• ์ธ๋ฉ”๋ชจ๋ฆฌ DB์ธ H2๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. ..
[Spring/JUnit] DataJpaTest์—์„œ JPAQueryFactory Bean ๋“ฑ๋ก ์—๋Ÿฌ : No qualifying bean of type 'com.querydsl.jpa.impl.JPAQueryFactory' available
ยท
Backend/Spring Boot
Spring์—์„œ JPA์™€ QueryDSL์„ ์‚ฌ์šฉํ•˜์—ฌ DB์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•˜๊ณ  ์žˆ์—ˆ๋‹ค.๊ทธ๋ฆฌ๊ณ  Repository ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.     ๐Ÿ’ป ๊ฐœ๋ฐœ ํ™˜๊ฒฝFramework : Spring Boot `3.2.3`DB : MySQL, H2Library : JPA, QueryDSL `5.0.0`Test : JUnit     โ—๏ธ์—๋Ÿฌ ๋ฉ”์‹œ์ง€Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'XXXCustomRepositoryImpl' defined in file [.../repository/XXXCustomRepositoryImpl.class]: Unsati..
[Spring] DTO ํด๋ž˜์Šค ๋ฐ์ดํ„ฐ ๋ฐ”์ธ๋”ฉ ์—๋Ÿฌ : com.fasterxml.jackson.databind.exc.InvalidDefinitionException : No serializer found for class
ยท
Backend/Spring Boot
๐Ÿ’ป ์—๋Ÿฌ ๋ฉ”์‹œ์ง€com.fasterxml.jackson.databind.exc.InvalidDefinitionException : No serializer found for class com.xxxxxxx.xxxxx.dto.user.ProfileDto and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.xxxxxxx.xxxxx.api.response.xxxxxxxxxx["ProfileDto"])     ๐Ÿ”Ž ์›์ธ Jackson์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ”์ธ๋”ฉํ•˜๋Š” ๊ณผ์ •์—์„œ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.  Jack..
[Spring Boot] Spring Boot์— Swagger ์ถ”๊ฐ€ํ•˜๊ธฐ
ยท
Backend/Spring Boot
Swagger๋Š” ๊ฐœ๋ฐœ์ž๊ฐ€ ์ž๋™์œผ๋กœ REST API๋ฅผ ๋ฌธ์„œํ™”ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” ์˜คํ”ˆ์†Œ์Šค ํ”„๋ ˆ์ž„์›Œํฌ์ด๋‹ค.  ๋ฐฑ์—”๋“œ์—์„œ ๊ฐœ๋ฐœํ•œ ์„œ๋ฒ„ API๋ฅผ ํ”„๋ก ํŠธ์—”๋“œ์—์„œ ์—ฐ๊ฒฐํ•ด์•ผ ํ•˜๋Š”๋ฐ, ๋ฌธ์„œํ™”๋ฅผ ํ•ด๋‘๋ฉด API๋ฅผ ์‰ฝ๊ฒŒ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์–ด ํ˜‘์—…ํ•˜๋Š” ๋ฐ ์ข‹๋‹ค. ๊ทธ๋ฆฌ๊ณ  Swagger ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ๊ฐ„๋‹จํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ํ•  ์ˆ˜ ์žˆ๋Š” UI๋„ ์ œ๊ณตํ•˜์—ฌ API ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๊ธฐ์—๋„ ์ข‹๋‹ค.      ๊ทธ๋™์•ˆ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉฐ, ์„œ๋ฒ„ API๋ฅผ ๋ฌธ์„œํ™”๋ฅผ ์œ„ํ•ด Swagger๋ฅผ ์‚ฌ์šฉํ–ˆ์—ˆ๋‹ค. ์ž‘๋…„์— Spring Boot 2.X ๋ฒ„์ „์—์„œ ๊ฐœ๋ฐœํ•˜๋ฉฐ Springfox๋ฅผ ์ ์šฉํ•ด Swagger๋ฅผ ์ถ”๊ฐ€ํ–ˆ์—ˆ๋Š”๋ฐ, ์ด๋ฒˆ์— Spring 3.X ๋ฒ„์ „์—์„œ ๊ฐœ๋ฐœํ•˜๋ฉฐ Springfox๊ฐ€ ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๋ฅผ ๋ฐœ๊ฒฌํ–ˆ๋‹ค.  Springdoc์„ ์ ์šฉํ•˜๋ฉด ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค๋Š”๋ฐ, ๋‘ ๋ผ์ด๋ธŒ..
giraffe_
'Backend/Spring Boot' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก