๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐ŸŽจ Projects19

[์—๋Ÿฌ๋ชจ์Œ] The dependencies of some of the beans in the application context form a cycle ์—๋Ÿฌ ์„ค๋ช… ์ž๋ฐ” ํ”„๋กœ์ ํŠธ ์ค‘ 2๊ฐœ์˜ ํด๋ž˜์Šค๊ฐ€ ์„œ๋กœ๋ฅผ ์ฐธ์กฐํ•˜๋Š” ํ˜•ํƒœ๋ฅผ ๊ฐ€์งˆ ๋•Œ ์ƒ๊ธฐ๋Š” ์—๋Ÿฌ SecurityConfig.java @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) @RequiredArgsConstructor public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Autowired private PrincipalOauth2UserService principalOauth2UserService; // ๋ฌธ์ œ๋˜๋Š” ๋ถ€๋ถ„ @Bean public BCryptPasswordEncoder encodePwd.. 2023. 3. 18.
๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ API Goal 1. ๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ API ์‚ฌ์šฉํ•˜๊ธฐ ๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ API 1. https://developers.naver.com/apps/#/register ๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ ํ•˜๊ธฐ 2. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋“ฑ๋ก (API ์ด์šฉ์‹ ์ฒญ) > ์นธ ์ฑ„์›Œ๋„ฃ๊ธฐ > ๋“ฑ๋กํ•˜๊ธฐ 3. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ •๋ณด Client ID์™€ Client Secret์„ application.properties์— ์ฑ„์›Œ๋„ฃ๊ธฐ 4. ์ž๋ฐ” ํ”„๋กœ์ ํŠธ application.properties์— ๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ ๊ด€๋ จ security ์„ค์ •ํ•˜๊ธฐ # NAVER SECURITY spring.security.oauth2.client.registration.naver.client-id=ํด๋ผ์ด์–ธํŠธID์ž…๋ ฅ spring.security.oauth2.client.registration.naver.. 2023. 3. 17.
Facebook ๋กœ๊ทธ์ธ API Goal 1. ํŽ˜์ด์Šค๋ถ ๋กœ๊ทธ์ธ API ์‚ฌ์šฉํ•˜๊ธฐ ํŽ˜์ด์Šค๋ถ ๋กœ๊ทธ์ธ API 1. https://developers.facebook.com/apps/ ์—์„œ ํŽ˜์ด์Šค๋ถ์— ๋กœ๊ทธ์ธํ•˜๊ธฐ 2. ํŽ˜์ด์Šค๋ถ ๋กœ๊ทธ์ธ API ์‚ฌ์šฉํ•˜๊ธฐ > My Apps 3. ์•ฑ ๋งŒ๋“ค๊ธฐ 4. ์•ฑ ํƒ€์ž… ์„ ํƒํ•˜๊ธฐ > ๋‹ค์Œ 5. ์•ฑ ์ด๋ฆ„ ์“ฐ๊ธฐ > ์•ฑ ๋งŒ๋“ค๊ธฐ 6. Facebook ๋กœ๊ทธ์ธ ์„ค์ •ํ•˜๊ธฐ > ์›น > ์‚ฌ์ดํŠธ URL์— http://localhost:8080 ์“ฐ๊ธฐ > ๋‹ค์Œ > ๋‹ค์Œ > ๋‹ค์Œ > ๋Œ์•„๊ฐ€๊ธฐ 7. ์„ค์ • > ๊ธฐ๋ณธ ์„ค์ • > ์•ฑ ID์™€ ์‹œํฌ๋ฆฟ ์ฝ”๋“œ ํ™•์ธ 8. App ID์™€ secret์„ application.properties์— ๋ณต๋ถ™ํ•˜๊ธฐ ## application.properties์— ํŽ˜์ด์Šค๋ถ ๋กœ๊ทธ์ธ API ์„ค์ • # SECURITY spring.se.. 2023. 3. 16.
๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ API Goal 1. ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ API ์‚ฌ์šฉํ•˜๊ธฐ ๊ตฌ๊ธ€ API 1. Google API Console https://console.cloud.google.com/apis/dashboard?project=able-math-371003&organizationId=0 2. ํ”„๋กœ์ ํŠธ ์ƒˆ๋กœ ๋งŒ๋“ค๊ธฐ 3. ์ƒˆ๋กœ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ ์„ ํƒ 4. OAuth ๋™์˜ ํ™”๋ฉด > “์™ธ๋ถ€” ์„ ํƒ > ๋งŒ๋“ค๊ธฐ 5. ์•ฑ ์ด๋ฆ„๊ณผ ์œ ์ € ์ด๋ฉ”์ผ ์„ค์ •ํ•˜๊ธฐ > ์ €์žฅ 6. ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด > ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด ๋งŒ๋“ค๊ธฐ > OAuth ํด๋ผ์ด์–ธํŠธ ID > ๋งŒ๋“ค๊ธฐ 7. OAuth ํด๋ผ์ด์–ธํŠธ ID์™€ secret ๋ณต์‚ฌํ•ด์„œ ์ž๋ฐ” ํ”„๋กœ์ ํŠธ application.properties์— ์“ฐ๊ธฐ. ์ด ์ •๋ณด๋Š” ๊ฐœ๋ฐœ์ž๋งŒ ์•Œ๊ณ  ์žˆ์–ด์•ผํ•˜๋Š” ์ •๋ณด์ž…๋‹ˆ๋‹ค. ๊นƒํ—ˆ๋ธŒ๋‚˜ ๋ฐ–์œผ๋กœ ๋…ธ์ถœ๋˜์ง€ ์•Š๋„๋ก ์ฃผ์˜.. 2023. 3. 15.
[GitHub] SQL ์ฝ”๋“œ ์ธ์‹ ๋ชปํ•จ ๋ฌธ์ œ ์ƒํ™ฉ GitHub์—์„œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ SQL ์ฝ”๋“œ๋ฅผ ์ธ์‹ํ•˜์ง€ ๋ชปํ•œ๋‹ค. ํ•ด๊ฒฐ SQL์„ ํฌํ•จํ•˜๋Š” ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— .gitattributes๋ผ๋Š” ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค. Add file > Create new file # .gitattributes ํŒŒ์ผ ๋‚ด์šฉ *.sql linguist-detectable=true *.sql linguist-language=sql ์ด์ œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์—์„œ .sql ํŒŒ์ผ๋“ค์„ ์ธ์‹ํ•˜์—ฌ ๋ช‡ ํผ์„ผํŠธ๊ฐ€ SQL ์ฝ”๋“œ์ธ์ง€ ํ‘œ์‹œํ•ด์ค€๋‹ค! ์ฐธ๊ณ  https://github.com/github/linguist/issues/3666 2023. 3. 12.
[์—๋Ÿฌ๋ชจ์Œ] exceeded the 'max_questions' resource ์—๋Ÿฌ ์„ค๋ช… ์ดํด๋ฆฝ์Šค์—์„œ ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ ์‹คํ–‰ ์ค‘์— ์ฝ”๋“œ ๊ณ„์† ์ˆ˜์ •-์ €์žฅ-์ˆ˜์ •-์ €์žฅ ๋ฐ˜๋ณตํ•˜๋‹ค ๋ณด๋‹ˆ ์ƒ๊ธด ์—๋Ÿฌ java.sql.SQLSyntaxErrorException: User 'scott' has exceeded the 'max_questions' resource (current value: 1000) ํ•ด๊ฒฐ 1. ์‹คํ–‰ ์ค‘์ด๋˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์ค‘์ง€ ์‹œ์ผฐ๋‹ค๊ฐ€ ๋‹ค์‹œ ์‹คํ–‰ํ•˜๊ธฐ๋งŒ ํ•ด๋„ ํ•ด๊ฒฐ ๋  ๋•Œ๊ฐ€ ์žˆ๋‹ค. 2. MySQL์—์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ ์œ ์ € ์™ธ์— ๋‹ค๋ฅธ ์œ ์ €๋กœ ์ ‘์†ํ•ด์„œ max_questions๋ฅผ 0์œผ๋กœ ๋ฆฌ์…‹ํ•ด์ค€๋‹ค. SET @MAX_QUESTIONS=0; FLUSH PRIVILEGES; ์ถ”๊ฐ€ ์„ค๋ช… max_questions๋ž€ 1์‹œ๊ฐ„ ์•ˆ์— MySQL์˜ user๊ฐ€ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ์ฟผ๋ฆฌ์˜ ๊ฐœ์ˆ˜์ด๋‹ค. ๋‚˜์˜ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€๋ฅผ.. 2023. 3. 8.
๋ฐฑ์ค€ํ—ˆ๋ธŒ ๋นจ๊ฐ„ ์ฒดํฌ ์—๋Ÿฌ ์„ค๋ช… ๋ฐฑ์ค€์—์„œ ๋ฌธ์ œ๋ฅผ ๋งž์ถ”๋ฉด ๋ฐฑ์ค€ํ—ˆ๋ธŒ๊ฐ€ ์ž๋™์œผ๋กœ ๋‚ด ๊นƒํ—ˆ๋ธŒ์— ํ‘ผ ๋ฌธ์ œ๋ฅผ ์—…๋กœ๋“œ ์‹œ์ผœ์ฃผ๋Š”๋ฐ ๋นจ๊ฐ„ ์ฒดํฌ๊ฐ€ ๋œฌ๋‹ค๋Š” ๊ฒƒ์€ ์—…๋กœ๋“œ๊ฐ€ ์‹คํŒจํ–ˆ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ํ•ด๊ฒฐ ์„œ๋กœ ๋‹ค๋ฅธ ๋„๋ฉ”์ธ ๊ฐ„ ์•ก์„ธ์Šค ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” CORS ํฌ๋กฌ ํ™•์žฅ์ž๋ฅผ ์ด์šฉํ•˜๋ฉด ๋œ๋‹ค! (์—ฌ๊ธฐ์„œ ๋‹ค์šด๋ฐ›๊ธฐ) ํ™•์žฅํ”„๋กœ๊ทธ๋žจ์„ ๋‹ค์šด ๋ฐ›๊ณ  ON ์‹œํ‚ค๋ฉด ๋ฐฑ์ค€ํ—ˆ๋ธŒ๊ฐ€ ๋‹ค์‹œ ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ•œ๋‹ค. CORS๋ž€ ์›น ํŽ˜์ด์ง€์—์„œ ๋‹ค๋ฅธ ๋„๋ฉ”์ธ์— ์ ‘๊ทผํ•  ๋•Œ ํ•„์š”ํ•œ ๋ณด์•ˆ ๋งค์ปค๋‹ˆ์ฆ˜์ด๋‹ค. ๋ฐฑ์ค€์—์„œ ๊นƒํ—ˆ๋ธŒ ๋ฆฌ์†Œ์Šค์— ์ ‘๊ทผํ•˜๋ ค๋‹ค ๋ณด๋‹ˆ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธด๊ฒŒ ์•„๋‹๊นŒ..? ์ฐธ๊ณ  https://www.moesif.com/blog/technical/cors/Authoritative-Guide-to-CORS-Cross-Origin-Resource-Sharing-for-REST-APIs/ 2023. 3. 7.
[์—๋Ÿฌ๋ชจ์Œ] Failed to configure a DataSource ์—๋Ÿฌ ์„ค๋ช… ์ดํด๋ฆฝ์Šค์—์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ์Šคํ”„๋ง ๋ถ€ํŠธ๋กœ ์‹คํ–‰ํ•  ๋•Œ ๋‚˜๋Š” ์—๋Ÿฌ Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. ํ•ด๊ฒฐ ํ”„๋กœ์ ํŠธ์˜ application.properties ํŒŒ์ผ์— JDBC url์„ ์ถ”๊ฐ€ํ•˜๋ฉด ๋œ๋‹ค. # DataSource spring.datasource.url=jdbc:mysql://localhost:3306/[DB์Šคํ‚ค๋งˆ๋ช…]?serverTimeZone=Asia/Seoul spring.datasource.username=[DB์ ‘์†Id] spring.datasource.password=[DB์ ‘์†Password] spring.dataso.. 2023. 3. 3.
[์—๋Ÿฌ๋ชจ์Œ] java.lang.UnsupportedClassVersionError ์—๋Ÿฌ ์„ค๋ช… ์ž๋ฐ” ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ ์ƒˆ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“  ํ›„ ํ”„๋กœ์ ํŠธ ์‹คํ–‰ ํ–ˆ์„ ๋•Œ ๋นŒ๋“œ๊ฐ€ ์ œ๋Œ€๋กœ ๋˜์ง€ ์•Š์•„ ๋‚˜๋Š” ์—๋Ÿฌ Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/SpringApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 ํ•ด๊ฒฐ ์Šคํ”„๋ง ๋ถ€ํŠธ ๋ฒ„์ „ ๋งž๊ฒŒ ๋‚ฎ์ถ”๋ฉด ๋œ๋‹ค (๋‚˜์˜ ๊ฒฝ์šฐ๋Š” ์›๋ž˜ 3.0.3 ์œผ๋กœ ๋˜์–ด ์žˆ๋˜๊ฑธ .. 2023. 3. 2.