๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ

1. ํด๋ž˜์Šค ์ƒ์† : ์ž์‹์ด ๋ถ€๋ชจ๋ฅผ ์„ ํƒํ•œ๋‹ค. ์„ ํƒ๋œ ๋ถ€๋ชจ๋Š” extends ๋’ค์— ๊ธฐ์ˆ ๋œ๋‹ค. ๋ถ€๋ชจ ๊ฐ์ฒด๊ฐ€ ๋จผ์ € ์ƒ์„ฑ์ด ๋˜๋ฉด, ํ›„์— ์ž์‹์˜ ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ์ด ๋œ๋‹ค. public class Child extends Parent{...} 1. ์—ฌ๋Ÿฌ๊ฐœ์˜ ๋ถ€๋ชจ ํด๋ž˜์Šค๋ฅผ ์ƒ์† ํ•  ์ˆ˜ ์—†๋‹ค 2. private ์ ‘๊ทผ์„ ๊ฐ–๋Š” ํ•„๋“œ์™€ ๋ฉ”์†Œ๋“œ๋Š” ์ƒ์† ๋Œ€์ƒ์—์„œ ์ œ์™ธ, default ์—์„œ๋Š” ๊ฐ™์€ package ๋‚ด์—์„œ๋งŒ ์ƒ์† ๊ฐ€๋Šฅ public class parent{ public String a; public String b; } public class child extends parent{ public String c; public child(String a, String b, String c){ this.a = a; // pare..
1. ์ธ์Šคํ„ด์Šค ๋ฉค๋ฒ„(Instance Field, Method) : ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑ ํ›„(new ์—ฐ์‚ฐ์ž ์‚ฌ์šฉ), ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ•„๋“œ์™€ ๋ฉ”์†Œ๋“œ ์ธ์Šคํ„ด์Šค ํ•„๋“œ๋Š” ๊ฐ์ฒด๋งˆ๋‹ค ๋”ฐ๋กœ ์กด์žฌํ•˜๊ณ , ์ธ์Šคํ„ด์Šค ๋ฉ”์†Œ๋“œ๋Š” ๋ฉ”์†Œ๋“œ ์˜์—ญ์— ์ €์žฅ๋˜๊ณ  ๊ณต์œ  - this : ๊ฐ์ฒด ๋‚ด๋ถ€์—์„œ ์ธ์Šคํ„ด์Šค ๋ฉค๋ฒ„๋ฅผ ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ ์ฃผ๋กœ, ์ƒ์„ฑ์ž์™€ ๋ฉ”์†Œ๋“œ์˜ ๋งค๊ฐœ ๋ณ€์ˆ˜์˜ ์ด๋ฆ„์ด ํ•„๋“œ์™€ ๋™์ผํ•  ๊ฒฝ์šฐ, ์ธ์Šคํ„ด์Šค ๋ฉค๋ฒ„ ์•ž์— ์ฃผ๋กœ ๋ถ™์—ฌ์ง„๋‹ค. private String sentence; // ์ธ์Šคํ„ด์Šค ํ•„๋“œ public Hello(String sentence){ this.sentence = sentence; // ์ธ์Šคํ„ด์Šค ํ•„๋“œ = ๋งค๊ฐœ๋ณ€์ˆ˜ ํ•„๋“œ } //---------------------------------------------------------..
3์›” 12์ผ์— ์ง„ํ–‰ํ•˜๋Š” SQL Developer ์ž๊ฒฉ์ฆ์„ ๋„์ „ํ•˜๊ณ ์ž ํ•œ๋‹ค. ๋ฐฉํ•™ ๋•Œ ๋”ฐ๋ ค๊ณ  ํ–ˆ์ง€๋งŒ, ์˜ฌํ•ด ์ฒซ ๋ฒˆ์งธ ์‹œํ—˜์ด 3์›” ๋‹ฌ์ด๊ธฐ์—,, ํ•™๊ต ๊ณต๋ถ€ํ•˜๋ฉด์„œ ๊ฐ™์ด ๋ณ‘ํ–‰ํ•ด์•ผ์ฅฅ์ฅฅ์ฅฅ ๋„ˆ์–ด๋ฌด ๋น„์‹ธ์„œ ํ•œ๋ฒˆ์— ๋ถ™์–ด์•ผ์ง€,,, ์–ดํœด ํ•™๊ต์—์„œ๋ž‘ ๋™์•„๋ฆฌ์—์„œ DB ๊ณต๋ถ€ํ•œ ๊ฒƒ์„ ๋ฐ”ํƒ•์œผ๋กœ ์—ด์‹ฌํžˆ ์ค€๋น„ํ•ด์•ผ๊ฒ ๋‹ค.
์•ฑ ๊ฐœ๋ฐœ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋ฉด์„œ User๊ฐ€ ์“ด ๊ธ€์„ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ, ๋ชจ๋“  ๊ธ€์ด ๋ถˆ๋Ÿฌ์™€์ง€๊ฒŒ ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ผ์ • ๋ถ€๋ถ„์˜ ๊ธ€๋งŒ ๋ถˆ๋Ÿฌ์™€์ง€๊ฒŒ api๋ฅผ ์ˆ˜์ •ํ•ด๋‹ฌ๋ผ๋Š” ๋ถ€ํƒ์„ ๋ฐ›์•˜๋‹ค. ์ธํ„ฐ๋„ท์— ์ฐพ์•„๋ณด๋‹ˆ, FrontEnd์˜ ์—ญํ• ์ธ ๊ฒƒ ๊ฐ™์•˜์ง€๋งŒ ์ผ๋‹จ ์•Œ๊ฒ ๋‹ค๊ณ  ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ํ•œ api๋ฅผ ์ˆ˜์ •ํ•ด๋ณด๊ณ ์žํ–ˆ๋‹ค. (์•ž์œผ๋กœ๋Š” ์ด๊ฒŒ ์„œ๋ฒ„์˜ ์—ญํ• ์ธ์ง€, ํ”„๋ก ํŠธ์˜ ์—ญํ• ์ธ์ง€ ๋‹ค์‹œ ํ™•์ธํ•œ ํ›„ api๋ฅผ ์ƒ์„ฑํ•ด์•ผ๊ฒ ๋‹ค) Jpa Repository๋ฅผ ํ†ตํ•ด์„œ User๊ฐ€ ์“ด ๊ธ€์˜ ๊ฐ’์„ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋œ๋‹ค. ์ด๋•Œ, Return variable์ด List๊ฐ€ ๋˜๋ฏ€๋กœ ๊ฐ’์„ ๋ณ€๊ฒฝํ•˜๋Š”๋ฐ for๋ฌธ์„ ์‚ฌ์šฉํ•ด์„œ List์— ์žˆ๋Š” ๊ฐ’์„ ๋˜๋‹ค๋ฅธ List๋กœ ์˜ฎ๊ฒจ์•ผํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณต์žกํ•œ ๋ฐ˜๋ณต๋ฌธ์ด ์‚ฌ์šฉ๋  ๊ฒƒ์œผ๋กœ ์˜ˆ์ƒ๋˜์—ˆ๋‹ค. for๋ฌธ์œผ๋กœ List๋ฅผ ๋˜ ๋‹ค๋ฅธ List๋กœ ์˜ฎ๊ธฐ๋ฉด์„œ ์•ˆ์— ์žˆ๋Š” ๊ฐ’์„ ๋ณ€๊ฒฝํ•˜๋Š”..
๊ทธ ์ „๊นŒ์ง€๋Š” api์—์„œ ์ง์ ‘ userid๋ฅผ ๊ฑด๋‚ด๊ณ  JPA CRUD FindByUserId๋ฅผ ํ†ตํ•ด ์œ ์ €์˜ ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์™”์—ˆ๋‹ค. ํ•˜์ง€๋งŒ ํšŒ์›๊ฐ€์ž…์„ ํ•˜๊ณ , ๋กœ๊ทธ์ธ์„ ํ•˜๊ฒŒ ๋˜๋ฉด token์„ ์ œ๊ณตํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ UMC APP API๋ฅผ ํŒ€์›๋ถ„๊ป˜์„œ ์ƒ์„ฑํ•ด์ฃผ์…จ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด, token(authorization์— ์žˆ๋Š”)๋ฅผ ๊ณ„์† ์‚ฌ์šฉํ•ด์„œ json์„ ๋ฐ›์•„์™€์•ผํ•˜๋Š” ์ƒํ™ฉ์—์„œ๋Š” userId๋ฅผ ๋ณด๋‚ด์ง€ ์•Š๊ณ  jwt๋ฅผ ํ†ตํ•ด์„œ ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์˜ฌ ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒํ•˜๋Š” ์˜๋ฌธ์ด ๋“ค์—ˆ๋‹ค. ์ด์— ๋ฐœ๊ฒฌํ•˜๊ฒŒ ๋œ 3๊ฐ€์ง€ ๋ฐฉ๋ฒ• ์ค‘, ๐Ÿ’ป๋™์•„๋ฆฌ ์•ฑ ํ”„๋กœ์ ํŠธ์—์„œ๋Š” Principal์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค. (@AuthenticationPrincipal ์ด๋‚˜ SecurityContextHolder, Authentication ๋ชจ๋‘ ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ ์—๋Ÿฌ ๋‚จ,, ์ด์œ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์›€,,..
Repository์—์„œ findBy ์ž‘์„ฑํ•˜๊ณ , ์ดํ›„์— List๋ฅผ ํ†ตํ•ด ๊ฐ’์„ ๋ชจ๋‘ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ ๋ชจ๋“  ๊ฐ’์ด ๋ถˆ๋Ÿฌ์ ธ์˜ค๊ฒŒ ๋œ๋‹ค. ํ•˜์ง€๋งŒ, User์™€ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ๊ฐœ์ธ ์ •๋ณด๊ฐ€ ๊ฐ™์ด ๋ถˆ๋Ÿฌ์ ธ์˜ค๊ฒŒ ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์–ด์„œ ์ด๋ฅผ ๋ฐฉ์ง€ํ•˜๊ณ ์žํ•œ๋‹ค. ๋ชจ๋“  ๊ฐ’์ด ๋ถˆ๋Ÿฌ์ ธ์˜ค๊ฒŒ ๋˜๋Š” ๊ฒฝ์šฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. @Getter @Entity @NoArgsConstructor @Table(name="user") public class UserEntity{ @Id @GeneratedValue private Long userIdx; @Column(nullable = false, length = 100) private String nickName; @Column(nullable = false, length = 100) private String user..
Spring boot์—์„œ Entity๋ฅผ ์ƒ์„ฑํ•œ ํ›„, @Setter๋ฅผ ํ†ตํ•ด setter ํ•จ์ˆ˜๋ฅผ ์ƒ์„ฑํ•˜๊ฒŒ ๋˜๋ฉด ๋‹ค๋ฅธ class์—์„œ๋„ ์ •๋ณด๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๊ธฐ์— ๋ณด์•ˆ์ ์œผ๋กœ๋„ ์ข‹์ง€ ์•Š๋‹ค. (์‚ฌ์šฉ์€ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ, ์ง€์–‘ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.) ๊ทธ๋ ‡๋‹ค๋ฉด @Setter ๋Œ€์‹ ์— ์ •๋ณด๋ฅผ ๋ณ€๊ฒฝํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์–ด๋–ค ๊ฒƒ์„ ์‚ฌ์šฉํ•ด์•ผ ํ• ๊นŒ? @Getter @Entity @NoArgsConstructor @Table(name="user") public class UserEntity{ @Id @GeneratedValue private Long userIdx; @Column(nullable = false, length = 100) private String nickName; @Column(nullable = false, length = 100) p..
1. ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ž๋ฐ”๋Š” ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ค‘ ํ•˜๋‚˜์ด๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ๊ฐ์ฒด๋ž€ ๋ฌด์—‡์ผ๊นŒ? ๊ฐ์ฒด๋ž€ ๋ฌผ๋ฆฌ์ ์œผ๋กœ ์กด์žฌํ•˜๊ฑฐ๋‚˜ ์ถ”์ƒ์ ์œผ๋กœ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๋“ค ์ค‘์—์„œ ์†์„ฑ์„ ๋‚˜ํƒ€๋‚ด๊ณ , ์‹๋ณ„์ด ๊ฐ€๋Šฅํ•œ ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ์ด๋•Œ, ๊ฐ์ฒด๊ฐ€ ๊ฐ€์ง„ ์†์„ฑ์„ Field, attribute๋ผ๊ณ  ํ•˜๊ณ , ๊ฐ์ฒด๊ฐ€ ํ–‰ํ•˜๋Š” ๋™์ž‘์„ Method๋ผ๊ณ  ํ•œ๋‹ค. ๊ฐ์ฒด๋“ค์€ ๋…๋ฆฝ์ ์œผ๋กœ ์กด์žฌํ•˜๋ฉฐ, ์„œ๋กœ Method๋ฅผ ํ†ตํ•ด ์ƒํ˜ธ์ž‘์šฉ์„ ํ•˜๊ฒŒ ๋œ๋‹ค. ๋ฉ”์†Œ๋“œ ํ˜ธ์ถœ์„ ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. University university = new University(); // University ํด๋ž˜์Šค์˜ constructor ํ˜ธ์ถœ ๋ฐ ๋ฉ”๋ชจ๋ฆฌ ์ƒ์„ฑ int courseNum= university.course();// University์˜ method์ธ course ๋ถˆ..
+ ๊ฐ์ฒด ๋‚ ์งœ ์–ป๋Š” ๋ช…๋ น์–ด: Calendar.getInstance() int year = now.get(Calendar.YEAR); int month = now.get(Calendar.MONTH) + 1; int day = now.get(Calendar.DAY_OF_MONTH); int week = now.get(Calendar.DAY_OF_WEEK); int hour = now.get(Calendar.HOUR); int minute = now.get(Calendar.MINUTE); int second = now.get(Calendar.SECOND); 1. ์—ด๊ฑฐ ํƒ€์ž…(Enum) : ์—ด๊ฑฐ ์ƒ์ˆ˜(enumeration constant) ์ค‘์—์„œ ์ƒ์ˆ˜๋ฅผ ์ €์žฅํ•˜๋Š” ํƒ€์ž… ์—ด๊ฑฐ ์ƒ์ˆ˜๋Š” ๋ชจ๋‘ ๋Œ€๋ฌธ์ž๋กœ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์ด ๊ด€๋ก€..
1. ๊ธฐ๋ณธ ํƒ€์ž… VS ์ฐธ์กฐ ํƒ€์ž… ๊ธฐ๋ณธ ํƒ€์ž…: byte, char, short, int, long, float, double, boolean ๋ณ€์ˆ˜๊ฐ€ ์‹ค์ œ ๊ฐ’์„ ๋ณ€์ˆ˜ ์•ˆ์— ์ €์žฅ -> ์Šคํƒ ์˜์—ญ์— ์ง์ ‘ ๊ฐ’์„ ๊ฐ€์ง ์ฐธ์กฐ ํƒ€์ž…: ๋ฐฐ์—ด, ์—ด๊ฑฐ, ํด๋ž˜์Šค, ์ธํ„ฐํŽ˜์ด์Šค ๋ณ€์ˆ˜๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ ๋ฒˆ์ง€๋ฅผ ๋ณ€์ˆ˜ ์•ˆ์—( ์ €์žฅ ( ex. String type) -> ํž™ ์˜์—ญ์˜ ๊ฐ์ฒด ์ฃผ์†Œ ๊ฐ€๋ฆฌํ‚ด -> ๋ฌธ์ž์—ด์ด ์ง์ ‘ ๋ณ€์ˆ˜์— ์ €์žฅ๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ๋ฌธ์ž์—ด์€ String ๊ฐ์ฒด๋กœ ์ƒ์„ฑ๋˜๊ณ  String ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์ฆ‰, String a = "์•ˆ๋…•";์ด๋ผ๋Š” ์ฝ”๋“œ์—์„œ๋Š” ์•ˆ๋…•์€ String ๊ฐ์ฒด๋กœ ์ƒ์„ฑ๋˜์–ด์„œ ํž™ ์˜์—ญ์— ์ €์žฅ ๋˜๊ณ , a๋Š” ์Šคํƒ ์˜์—ญ์— ์ €์žฅ๋˜์–ด "์•ˆ๋…•" ํž™ ์˜์—ญ์˜ ๋ฒˆ์ง€๋ฅผ ์ €์žฅํ•œ๋‹ค. 2. ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ ์˜์—ญ(Runtime Data A..
chaerlo127
'๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (10 Page)