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

๐Ÿ’ปWEB BackEnd

(19)
ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ - (๋ฐฉ๋ฒ•2)๋กœ์ปฌ์—์„œ ์ง์ ‘ ์ƒ์„ฑ ๋กœ์ปฌ์—์„œ ํด๋”(java, resources)์™€ ํŒŒ์ผ(pom.xml)์„ ์ง์ ‘ ๋งŒ๋“ค์–ด ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ• 1) ํด๋”(java, resources)์™€ "ํ”„๋กœ์ ํŠธ ํด๋” > src ํด๋” > main ํด๋” > java, resources ํด๋”" ๋ชจ๋‘ ์ƒ์„ฑ 2) ํŒŒ์ผ(pom.xml) ์ƒ์„ฑ srcํด๋”์™€ ๊ฐ™์€ ์œ„์น˜์— pom.xml ํŒŒ์ผ ์ƒ์„ฑ 4.0.0 spring4 testPjt 0.0.1-SNAPSHOT org.springframework spring-context 4.1.0.RELEASE maven-compiler-plugin 3.1 1.8 1.8 UTF-8 3) ์ดํด๋ฆฝ์Šค์—์„œ importํ•˜๊ธฐ ์ดํด๋ฆฝ์Šค์—์„œ Maven์œผ๋กœ import
๊ฐ์ฒด ์ƒ์„ฑ - (๋ฐฉ๋ฒ•2) ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ†ตํ•ด ๊ฐ์ฒด ์ƒ์„ฑ ๋ชฉ์ฐจ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ†ตํ•ด ๊ฐ์ฒด ์ƒ์„ฑ Bean์˜ ๋ฒ”์œ„ ์„ค์ • ํŒŒ์ผ์ด ์—ฌ๋Ÿฌ๊ฐœ์ผ ๊ฒฝ์šฐ! ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ†ตํ•ด ๊ฐ์ฒด ์ƒ์„ฑ 1) src/main/resources/applicationContext.xmlํŒŒ์ผ ์ƒ์„ฑ //bean์œผ๋กœ ๊ฐ์ฒด ์ƒ์„ฑ๋จ 2) MainClass ์ฝ”๋“œ ์ž‘์„ฑ package testPjt; import org.springframework.context.support.GenericXmlApplicationContext; public class MainClass { public static void main(String[] args) { //TransportationWalk transportationWalk = new TransportationWalk(); //transportationWalk.move(); //..
๊ฐ์ฒด ์ƒ์„ฑ - (๋ฐฉ๋ฒ•1) new์—ฐ์‚ฐ์ž๋ฅผ ์ด์šฉ new์—ฐ์‚ฐ์ž๋ฅผ ์ด์šฉํ•ด ๊ฐ์ฒด ์ƒ์„ฑ 1) ํด๋ž˜์Šค ์ƒ์„ฑ ํด๋ž˜์Šค ์ƒ์„ฑ ์™„๋ฃŒ! package testPjt; public class TransportationWalk { public void move() { System.out.println("hello"); } } 2) ๋ฉ”์ธํด๋ž˜์Šค ์ƒ์„ฑ package testPjt; public class MainClass { public static void main(String[] args) { TransportationWalk transportationWalk = new TransportationWalk(); transportationWalk.move(); } } ๊ฒฐ๊ณผ ํ™”๋ฉด!
์ž์ฃผ ์“ฐ์ด๋Š” ์ดํด๋ฆฝ์Šค ๋‹จ์ถ•ํ‚ค https://velog.io/@janeljs/eclipse-shortcuts
ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ - (๋ฐฉ๋ฒ•1)eclipse์—์„œ ์ƒ์„ฑ ๋ชฉ์ฐจ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ pom.xml ์ž‘์„ฑ ํด๋” ๋ฐ pom.xmlํŒŒ์ผ์˜ ์ดํ•ด ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ Maven์„ ์ด์šฉํ•ด์„œ ์Šคํ”„๋ง ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์™„๋ฃŒ! pom.xml ํŒŒ์ผ pom.xmlํŒŒ์ผ์€ Maven ์„ค์ •ํŒŒ์ผ๋กœ, Maven์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์—ฐ๊ฒฐํ•ด์ฃผ๊ณ , ๋นŒ๋“œ๋ฅผ ์œ„ํ•œ ํ”Œ๋žซํผ์ด๋‹ค. Maven์˜ ๋นŒ๋“œ ์ •๋ณด๋ฅผ ๋‹ด๊ณ ์žˆ๋Š” ํŒŒ์ผ POM(Project Object Model)์„ ์„ค์ •ํ•˜๋Š” ๋ถ€๋ถ„ ํ”„๋กœ์ ํŠธ ๋‚ด์˜ ๋นŒ๋“œ ์˜ต์…˜์„ ์„ค์ •ํ•˜๋Š” ๋ถ€๋ถ„ pom.xml ํŒŒ์ผ ์ž‘์„ฑ 4.0.0 spring4 testPjt 0.0.1-SNAPSHOT ์— ์•„๋ž˜์™€ ๊ฐ™์ด , ์ฝ”๋“œ ๋ถ€๋ถ„ ์ถ”๊ฐ€ 4.0.0 spring4 testPjt 0.0.1-SNAPSHOT org.springframework spring-context 4.1.0.RELEASE maven..
java, eclipse ์„ค์น˜ java ์„ค์น˜ ๋‹ค์Œ ์‚ฌ์ดํŠธ์—์„œ x64 Installer ๋ฅผ ํด๋ฆญํ•ด ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ธฐ https://www.oracle.com/java/technologies/downloads/#jdk19-windows Download the Latest Java LTS Free Subscribe to Java SE and get the most comprehensive Java support available, with 24/7 global access to the experts. www.oracle.com eclipse ์„ค์น˜ https://www.eclipse.org/downloads/ Eclipse Downloads | The Eclipse Foundation The Eclipse Foundation - home to ..
์Šคํ”„๋ง ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ๋Š” ์ฃผ์š”๊ธฐ๋Šฅ์œผ๋กœ DI, AOP, MVC, JDBC ๋“ฑ์„ ์ œ๊ณตํ•œ๋‹ค. ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ ๋ชจ๋“ˆ ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ ์ œ๊ณตํ•˜๊ณ  ์žˆ๋Š” ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด, ๋ชจ๋“ˆ์— ๋Œ€ํ•œ ์˜์กด์„ค์ •์„ ๊ฐœ๋ฐœ ํ”„๋กœ์ ํŠธ์—์„œ XMLํŒŒ์ผ๋“ค์„ ์ด์šฉํ•ด์„œ ๊ฐœ๋ฐœ์ž๊ฐ€ ์ง์ ‘ ํ•˜๋ฉด ๋œ๋‹ค. spring-core DI, IoC ์ œ๊ณต spring-aop AOP๊ตฌํ˜„ ๊ธฐ๋Šฅ ์ œ๊ณต spring-jdbc ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์‰ฝ๊ฒŒ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ ์ œ๊ณต spring-tx ์Šคํ”„๋ง์—์„œ ์ œ๊ณตํ•˜๋Š” ํŠธ๋žœ์žญ์…˜ ๊ด€๋ จ ๊ธฐ๋Šฅ ์ œ๊ณต spring-webmvc ์Šคํ”„๋ง์—์„œ ์ œ๊ณตํ•˜๋Š” Controller์™€ View๋ฅผ ์ด์šฉํ•œ MVC ๊ตฌํ˜„ ๊ธฐ๋Šฅ ์ œ๊ณต ์Šคํ”„๋ง ์ปจํ…Œ์ด๋„ˆ(IoC) ์Šคํ”„๋ง์—์„œ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์กฐ๋ฆฝํ•˜๋Š” ์ปจํ…Œ์ด๋„ˆ๋กœ, ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋œ ๊ฐ์ฒด๋ฅผ ๋นˆ..
๋…ธ๋“œ์˜ ์ „์—ญ๊ฐ์ฒด์™€ ์ „์—ญ ๋ณ€์ˆ˜ ๋…ธ๋“œ๋Š” ์‹คํ–‰์ค‘์ธ ํ”„๋กœ๊ทธ๋žจ ์–ด๋””์—์„œ๋“ ์ง€ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ์ „์—ญ ๋ณ€์ˆ˜ ๋ฐ ์ „์—ญ ๊ฐ์ฒด๋ฅผ ์ œ๊ณตํ•œ๋‹ค. ์ด๋Ÿฌํ•œ ์ „์—ญ ๊ฐ์ฒด, ์ „์—ญ ๋ณ€์ˆ˜๋“ค์€ ๋ชจ๋“ˆ์„ ๋ถˆ๋Ÿฌ์˜ค์ง€ ์•Š๊ณ ๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๋…ธ๋“œ์—๋Š” ์›น ๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•œ window, document ๋“ฑ์˜ ๊ฐ์ฒด ๋Œ€์‹  ์ด๊ฒƒ์„ ์‚ฌ์šฉํ•œ๋‹ค. ์ „์—ญ(global) ๊ฐ์ฒด ์ „์—ญ ๊ฐ์ฒด๋Š” ๋ชจ๋“  ๋…ธ๋“œ ํ”„๋กœ๊ทธ๋žจ์—์„œ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋‹ค. ์ „์—ญ ๊ฐ์ฒด๋Š” global.console ์ฒ˜๋Ÿผ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‚˜, global ์€ ์ƒ๋žต์ด ๊ฐ€๋Šฅํ•˜๋‹ค. global ๊ฐ์ฒด์— ์ •์˜๋œ ๋‚ด์šฉ๋“ค์€ REPL ํ™˜๊ฒฝ์—์„œ global ๊ฐ์ฒด๋ฅผ ํ™•์ธํ•ด ๋ณด๋ฉด ์•Œ ์ˆ˜ ์žˆ๋‹ค. global ๊ฐ์ฒด์˜ ์†์„ฑ์— ๊ฐ’์„ ๋Œ€์ž…ํ•˜์—ฌ ํŒŒ์ผ ๊ฐ„์— ๋ฐ์ดํ„ฐ๋ฅผ ๊ณต์œ ํ•  ์ˆ˜๋Š” ์žˆ์ง€๋งŒ, ํ”„๋กœ๊ทธ๋žจ์˜ ๊ทœ๋ชจ๊ฐ€ ์ปค์งˆ์ˆ˜๋ก ์–ด๋–ค ํŒŒ์ผ์—์„œ global ๊ฐ์ฒด์— ๊ฐ’์„ ๋Œ€์ž…ํ–ˆ๋Š”์ง€ ์ฐพ๊ธฐ ํž˜๋“ค์–ด..
๋…ธ๋“œ์˜ ๋ชจ๋“ˆ ๋…ธ๋“œ๋Š” ํ™•์žฅ์„ฑ์„ ์œ„ํ•ด ๋ชจ๋“ˆ ๊ตฌ์กฐ๋ฅผ ํ†ตํ•ด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌ์„ฑํ•˜๋„๋ก ํ•˜๊ณ  ์žˆ๋‹ค. ์ด๋ ‡๊ฒŒ ๋ชจ๋“ˆ ๋‹จ์œ„๋กœ ๊ตฌ์„ฑ๋œ๋‹ค๋Š” ๊ฒƒ์€ ๊ฐ์ฒด ์ง€ํ–ฅ ์ปจ์…‰์œผ๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ๊ตฌ์„ฑ๋œ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค๊ณ  ๋งํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ชจ๋“ˆ์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ด๋ฃจ๋Š” ๊ธฐ๋ณธ ๋‹จ์œ„๋กœ, ๋ณดํ†ต ๋‹ค์ˆ˜์˜ ํด๋ž˜์Šค์™€ ์ด๋ฅผ ํ†ตํ•ด ์ƒ์„ฑํ•œ ๊ฐ์ฒด ๋“ฑ์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค. ๋ชจ๋“ˆ์˜ ์ข…๋ฅ˜ ๋…ธ๋“œ์—์„œ๋Š” ๋ชจ๋“ˆ์˜ ์ข…๋ฅ˜๋ฅผ ํฌ๊ฒŒ ๋…ธ๋“œ ์„ค์น˜ ์‹œ ๊ธฐ๋ณธ์ ์œผ๋กœ ์„ค์น˜๋˜์–ด ์žˆ๋Š”์ง€์— ๋Œ€ํ•œ ์œ ๋ฌด๋ฅผ ํ†ตํ•ด ๊ธฐ๋ณธ ๋ชจ๋“ˆ๊ณผ ํ™•์žฅ ๋ชจ๋“ˆ๋กœ, ๋‹จ์ˆœํžˆ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์ž‘์„ฑํ•˜์˜€๋Š”์ง€, C/C++ ๋“ฑ์˜ ๋‹ค๋ฅธ ์–ธ์–ด๋กœ ์ž‘์„ฑํ•˜๊ณ  ๋นŒ๋“œํ•˜์—ฌ ๊ฐœ๋ฐœํ•˜์˜€๋Š”์ง€์— ๋”ฐ๋ผ ์ผ๋ฐ˜ ๋ชจ๋“ˆ๊ณผ ๋„ค์ดํ‹ฐ๋ธŒ ๋ชจ๋“ˆ๋กœ, ๊ทธ๋ฆฌ๊ณ  ์ง€๊ธˆ ํ˜„์žฌ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์œ„ํ•ด์„œ๋งŒ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์„ค์น˜ํ–ˆ๋Š”์ง€์— ๋”ฐ๋ผ ๊ธ€๋กœ๋ฒŒ ๋ชจ๋“ˆ๊ณผ ๋กœ์ปฌ ๋ชจ๋“ˆ ์ •๋„๋กœ ๋ถ„๋ฅ˜ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ชจ๋“ˆ ์‹๋ณ„์ž ๋…ธ๋“œ์˜ ๋ชจ๋“ˆ ์ด..