์ „์ฒด ๊ธ€

Tomcat error) java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens https ์š”์ฒญ์„ ์‹œ๋„ํ•˜๋ ค๊ณ  ํ•  ๋•Œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์—๋Ÿฌ์ด๋‹ค. ํ†ฐ์บฃ ์ชฝ์—์„œ https์„ค์ •์„ ํ•ด์ฃผ์ง€ ์•Š์•˜๋Š”๋ฐ https๋กœ ์š”์ฒญํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์—๋Ÿฌ์ด๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 1. url์„ http๋กœ ๋ฐ”๊พธ๋ฉด ํ•ด๊ฒฐ๋œ๋‹ค. 2. ์„œ๋ฒ„ ํฌํŠธ๋ฅผ ๋ฐ”๊ฟ” ๋ณธ๋‹ค. 3. ํ”„๋กœ์„ธ์Šค๋ฅผ ์ฐพ์•„์„œ ์ข…๋ฃŒ์‹œํ‚จ๋‹ค.
JPA๊ฐ€ ๊ด€๊ณ„ํ˜•๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋งž๊ฒŒ SQL์„ ๋Œ€์‹  ์ƒ์„ฑํ•˜์—ฌ ์‹คํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์‹ค์ œ๋กœ ์‹คํ–‰๋œ ์ฟผ๋ฆฌ์˜ ํ˜•ํƒœ๊ฐ€ ๊ถ๊ธˆํ•  ์ˆ˜ ์žˆ๋‹ค. application.properties๋ฅผ ๋งŒ๋“ค์–ด์ค€ ํ›„ spring.jpa.show_sql = true ๋ฅผ ์ž‘์„ฑํ•ด์ค€๋‹ค. ์งœ๋ž€!
bulid.gradle์— ์˜์กด์„ฑ ๋“ฑ๋กํ•˜๊ธฐ Entity ํด๋ž˜์Šค Entity๊ฐ€ not null์ผ ๊ฒฝ์šฐ Builder๊ธฐ๋ฐ˜์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” ํŒจํ„ด์œผ๋กœ ๋งŒ๋“ค๋•Œ Assert.notNull(title, "title must not be null"); Assert๋ฅผ ์ด์šฉํ•ด ๊ฐ์ฒด๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ์ƒ์„ฑํ•œ๋‹ค Postsํด๋ž˜์Šค๋กœ Database๋ฅผ ์ ‘๊ทผํ•˜๊ฒŒ ํ•ด์ค„ PostsRepository ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ Entityํด๋ž˜์Šค์™€ ๊ฐ™์€ ์œ„์น˜์— ๋งŒ๋“ค์–ด์ค€๋‹ค(*) JpaReopository ๋ฅผ ์ƒ์†ํ•˜๋ฉด ๊ธฐ๋ณธ์ ์ธ CRUD๋ฉ”์†Œ๋“œ๊ฐ€ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ๋‹ค. ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ํ™•์ธํ•˜์ž!
@RunWith(SpringRunner.class) ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•  ๋•Œ JUnit์— ๋‚ด์žฅ๋œ ์‹คํ–‰์ž ์™ธ ๋‹ค๋ฅธ ์‹คํ–‰์ž๋ฅผ ์‹คํ–‰ ์Šคํ”„๋ง ๋ถ€ํŠธ ํ…Œ์ŠคํŠธ - JUnit์‚ฌ์ด์— ์—ฐ๊ฒฐ์ž ์—ญํ• ์„ ํ•จ @WebMvcTest Web์— ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๋Š” ์–ด๋…ธํ…Œ์ด์…˜, @Controller,@ControllerAdvice๋“ฑ Controller์—์„œ ์ด์šฉ ๊ฐ€๋Šฅํ•œ ์–ด๋…ธํ…Œ์ด์…˜์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. @Autowired ๋นˆ์„ ์ฃผ์ž… MockMvc HTTP์˜ GET,POST๋“ฑ์— ๋Œ€ํ•œ ์›นAPI๋ฅผ ํ…Œ์ŠคํŠธํ•  ๋•Œ ์‚ฌ์šฉ ์™ธ๋ถ€์˜ ๊ฒฐ๊ณผ์— ํฌ๊ฒŒ ์˜์กดํ• ๋•Œ, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋กœ๋ถ€ํ„ฐ ํŠน์ • ๊ฐ’์„ ๋ฐ›์„ ๋•Œ, ํŠน์ • ์‹œ๊ฐ์—๋งŒ ์‹คํ–‰๋˜๋Š” ๊ฒฝ์šฐ ๋“ฑ perform() HTTP GET,POST ์š”์ฒญ, ์ฒด์ด๋‹ ์ง€์› andExpect() ์„ ์ด์šฉํ•ด์„œ ๋‹ค์–‘ํ•˜๊ฒŒ ๊ฒ€์ฆํ•  ์ˆ˜ ์žˆ๋‹ค. assertThat()
Controller @SpringBootApplication ์Šคํ”„๋ง๋ถ€ํŠธ์˜ ์ž๋™ ์„ค์ •, ์Šคํ”„๋ง Bean ์ฝ๊ธฐ์™€ ์ƒ์„ฑ์„ ๋ชจ๋‘ ์ž๋™์œผ๋กœ ์„ค์ •ํ•จ ํ•ด๋‹น class์— ์žˆ๋Š” ์œ„์น˜๋ถ€ํ„ฐ ์„ค์ •์„ ์ฝ์–ด ๊ฐ€๊ธฐ ๋•Œ๋ฌธ์— ํ•ญ์ƒ ํ”„๋กœ์ ํŠธ์˜ ์ตœ์ƒ๋‹จ์— ์œ„์น˜ํ•ด์•ผ ํ•จ. SpringBootApplication.run() ์Šคํ”„๋ง๋ถ€ํŠธ์˜ ๋‚ด์žฅ was์ด๋‹ค. ์™ธ์žฅ was๋ฅผ ์‚ฌ์šฉํ•ด๋„ ๋˜์ง€๋งŒ ๋‚ด์žฅ was ์‚ฌ์šฉ ๊ถŒ๊ณ  (์–ธ์ œ ์–ด๋””์„œ๋‚˜ ๊ฐ™์€ ํ™˜๊ฒฝ์—์„œ ์Šคํ”„๋ง ๋ถ€ํŠธ๋ฅผ ๋ฐฐํฌ) ์„ฑ๋Šฅ์ƒ ์ด์Šˆ : ํ†ฐ์บฃ ์—ญ์‹œ ์„œ๋ธ”๋ฆฟ์œผ๋กœ ์ด๋ฃจ์–ด์ง„ ์ž๋ฐ” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด๋‹ค. ๋˜‘๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์œผ๋ฏ€๋กœ ํฌ๊ฒŒ ๊ณ ๋ คํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค. @RestController ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ JSON์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ์ปจํŠธ๋กค๋Ÿฌ๋กœ ๋งŒ๋“ค์–ด ์คŒ ์˜ˆ์ „์—๋Š” @ResposeBody๋ฅผ ๊ฐ ๋ฉ”์†Œ๋“œ๋งˆ๋‹ค ์„ ์–ธ ํ–ˆ๋˜๊ฒƒ์„ ํ•œ๋ฒˆ์— ์‚ฌ์šฉํ•  ์ˆ˜ ..
JavaScript์—์„œ์˜ ๋ณ€์ˆ˜ ์„ ์–ธ ๋ฐฉ์‹ ์ค‘ var, const, let์˜ ์ฐจ์ด์  ๋จผ์ € Hoisting๊ณผ Scope์˜ ๊ฐœ๋…์ด ํ•„์š”ํ•˜๋‹ค. Hoisting Hoist๋ž€ ๋ณ€์ˆ˜์˜ ์ •์˜๊ฐ€ ๋ฒ”์œ„์— ๋”ฐ๋ผ ์„ ์–ธ, ์ดˆ๊ธฐํ™”, ํ• ๋‹น ๋ถ„๋ฆฌ๋˜๋Š” ๊ฒƒ์„ ์˜๋ฏธ (์ „์—ญ๋ณ€์ˆ˜์™€ ์ง€์—ญ๋ณ€์ˆ˜) Scope - ์ „์—ญ ์Šค์ฝ”ํ”„, ์ง€์—ญ ์Šค์ฝ”ํ”„ 1. var ๋ณ€์ˆ˜ ์„ ์–ธ์˜ ๊ฒฝ์šฐ ์œ ๋™์ ์œผ๋กœ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๋‹ค. function scope 2. const ๋ณ€์ˆ˜์— ์žฌ์„ ์–ธ, ์žฌํ• ๋‹น ๋ถˆ๊ฐ€ block scope ์ง€์—ญ ์Šค์ฝ”ํ”„ 3. let ๋ณ€์ˆ˜์— ์žฌํ• ๋‹น ๊ฐ€๋Šฅ block scope ES6์—์„œ๋Š” var๋ณด๋‹ค๋Š” const์™€ let์„ ์‚ฌ์šฉํ•ด์„œ ์ •ํ™•ํ•œ ๋ณ€์ˆ˜ ์‚ฌ์šฉ์„ ๊ถŒํ•œ๋‹ค.
๋ฉ”์ธํŽ˜์ด์ง€์— ๊ฐ€์ž…ํ•œ ํšŒ์›์˜ ์ˆ˜๋ฅผ ํ‘œ์‹œํ•ด์ฃผ๊ณ  ์‹ถ์€๋ฐ ํšŒ์›์ด ๊ฐ€์ž…ํ–ˆ์„๋•Œ ๋ฐ”๋กœ ํ‘œ์‹œ๋˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ ๋งค์ผ ์‹œ๊ฐ„์„ ์ •ํ•ด๋‘๊ณ  ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ ํ•˜๊ฒŒ ํ•˜๊ณ ์‹ถ์—ˆ๋‹ค. servlet-context์— xmlns:task="http://www.springframework.org/schema/task" http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd ์ถ”๊ฐ€ ํ•ด์ฃผ์—ˆ๊ณ  context:component-scan base-package ์—๋Š” ์ ์šฉํ•˜๋Š” ๊ฒฝ๋กœ ์ ์–ด์ฃผ๋ฉด ๋˜๋Š”๋ฐ com.min.app ์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” ํŒจํ‚ค์ง€ ๋ชจ๋‘๋ฅผ ์„ ํƒํ–ˆ๋‹ค ๊ทธ๋‹ค์Œ ์Šค์ผ€์ฅด๋Ÿฌ ์‚ฌ์šฉํ•  class๋ฅผ ๋งŒ๋“ค์–ด์ฃผ์—ˆ๋‹ค. public static i..
์ดํด๋ฆฝ์Šค Help - Install new software... - Work with : http://download.eclipse.org/mpc/photon Eclipse software repository | The Eclipse Foundation The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 360 open source projects, including runtimes, tools and frameworks. download.eclipse.org
์• ์ •์“ฐ
์• ์ •์ฝ”๋”ฉ ๐Ÿ’ป