Spring ๊ธฐ์ด(31)
-
Spring @RestController ๋ฅผ ์ด์ฉํ ๊ฐ๋จํ ๊ฒ์ํ, ํ์ด์ง
1. REST(REpresentational State Transfer) : ํน์ URI๋ฅผ ํตํด ์ฌ์ฉ์๊ฐ ์ํ๋ ์ ๋ณด๋ฅผ ์ ๊ณต๋ฐ๋ ํ์์ด๋ค. ์ด๋ ๊ฒ REST ๋ฐฉ์์ผ๋ก ์๋น์ค์ ๊ณต์ด ๊ฐ๋ฅํ ๊ฒ์ RESTful ํ๋ค๋ผ๊ณ ํ๋ค. 2. @RestController https://hyejin.tistory.com/275 Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ๊ฒ์ํ https://hyejin.tistory.com/272 Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ (@RequestBody, @ResponseBody, GET, POST, PUT, DELETE, Postman ์ค์น ๋ฐ ํ ์คํธ https://hyejin.tistory.com/265 Spring MVC, Mybatis [2].. hyejin.tistor..
2021.12.06 -
Spring Security JDBC ์ฌ์ฉํ ๋ก๊ทธ์ธ ์ฒ๋ฆฌ (BCryptPasswordEncoder ์ํธํ)
์ด๋ฒ์๋ Spring Security ์์ JDBC๋ฅผ ์ฌ์ฉํด์ ๋ก๊ทธ์ธ ์ฒ๋ฆฌ๋ฅผ ํด๋ณผ ์์ ์ด๋ค. https://hyejin.tistory.com/281 Spring Security ๋ก๊ทธ์ธ ์ธ์ฆ ๋ฐ ์ธ๊ฐ (Security ํ๊ฒฝ์ค์ , AuthenticationManger, AutenticationProvider) 1. Spring Security ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น Spring ๋ฒ์ : 5.2.13 java : 1.8 1๏ธโฃ Spring Security Web https://mvnrepository.com/artifact/org.springframework.security/spring-security-web 2๏ธโฃ Spring Securi.. hyejin.tistory.com ์ฌ๊ธฐ์ ํ๋ ๋ฐฉ์์ InMemory ๋ฐฉ..
2021.12.03 -
Spring Security ๋ก๊ทธ์ธ ์ธ์ฆ ๋ฐ ์ธ๊ฐ (Security ํ๊ฒฝ์ค์ , AuthenticationManger, AutenticationProvider)
1. Spring Security ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น Spring ๋ฒ์ : 5.2.13 java : 1.8 1๏ธโฃ Spring Security Web https://mvnrepository.com/artifact/org.springframework.security/spring-security-web 2๏ธโฃ Spring Security Core https://mvnrepository.com/artifact/org.springframework.security/spring-security-core 3๏ธโฃ Spring Security Config https://mvnrepository.com/artifact/org.springframework.security/spring-security-config 4๏ธโฃ Spri..
2021.12.02 -
Spring interceptor๋ฅผ ํ์ฉํ ๋ก๊ทธ์ธ ๋ฐ ์ธ๊ฐ(Authorization)
1. ์ธ์ฆ(Authentication)๊ณผ ์ธ๊ฐ(Authorization) 1๏ธโฃ ์ธ์ฆ(Authentication) : ์์คํ ์ ๊ทผ ์, ๋ฑ๋ก๋ ์ฌ์ฉ์์ธ์ง ์ฌ๋ถ๋ฅผ ํ์ธํ๋ ๊ฒ ex) ๋ก๊ทธ์ธ 2๏ธโฃ ์ธ๊ฐ(Authorization) : ์์คํ ์ ๊ทผ ํ, ์ธ์ฆ๋ ์ฌ์ฉ์์๊ฒ ๊ถํ์ ๋ถ์ฌํ๋ ๊ฒ ๊ถํ์ ๋ฐ๋ผ ์ฌ์ฉ ๊ฐ๋ฅํ ๊ธฐ๋ฅ์ด ์ ํ๋จ ex) ์ฌ์ฉ์ ๋ฑ๊ธ (์ผ๋ฐ/ vip/ ๊ด๋ฆฌ์) 2. Spring MVC ๊ฒ์ํ์ ์ธ์ฆ, ๊ถํ ์ถ๊ฐ https://hyejin.tistory.com/276 Spring MVC ๊ฐ๋จํ ๊ฒ์ํ ๋ง๋ค๊ธฐ (+ ํผ ๋ฐ์ดํฐ ์ ํจ์ฑ ๊ฒ์ฆํ๊ธฐ Validator) https://hyejin.tistory.com/270?category=1022293 Spring MVC ๊ฐ๋จํ ๊ฒ์ํ ๋ง๋ค๊ธฐ ๊ฐ๋จํ ์ฌ์ฉ์..
2021.12.02 -
Spring Transaction ๊ฐ๋จํ ํฐ์ผ ๊ตฌ๋งค ์๋น์ค ์์
1. Transaction https://hyejin.tistory.com/119?category=975063 [Database] Transaction๊ณผ Trigger 1. Transaction ํธ๋์ญ์ ์ด๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ํ๋ฅผ ๋ณํ์ํค๋ ํ๋์ ๋ ผ๋ฆฌ์ ๊ธฐ๋ฅ์ ์ํํ๊ธฐ ์ํ ์์ ์ ๋จ์ ๋๋ ํ๊บผ๋ฒ์ ์ํ๋์ด์ผ ํ ์ผ๋ จ์ ์ฐ์ฐ๋ค์ ์๋ฏธํ๋ค. ํธ๋์ญ์ ์ ๋ฐ์ดํฐ๋ฒ ์ด hyejin.tistory.com ํธ๋์ญ์ ์ด๋ ๋ ผ๋ฆฌ์ ์์ ๋จ์๋ก, ํธ๋์ญ์ ์ ๊ตฌ์ฑํ๋ ์ฌ๋ฌ ์์ ์ค ์ด๋ค ํ ๋ถ๋ถ์ ์์ ์ด ์๋ฃ๋์๋ค๊ณ ํ๋๋ผ๋, ๋ค๋ฅธ ๋ถ๋ถ์ ์์ ์ด ์๋ฃ๋์ง ์์ ๊ฒฝ์ฐ ์ ์ฒด ํธ๋์ญ์ ์ ์ทจ์๋์ด์ผ ํ๋ค. commit : ํธ๋์ญ์ ์ ์๋ฃํ๋ ๊ฒ rollback : ํธ๋์ญ์ ์ ์ทจ์ํ๋ ๊ฒ 2. Transaction์ ์ด์ฉํ ๊ฐ๋จํ ํฐ..
2021.12.01 -
Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ๊ฒ์ํ XML.ver (JAXB)
https://hyejin.tistory.com/275 Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ๊ฒ์ํ https://hyejin.tistory.com/272 Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ (@RequestBody, @ResponseBody, GET, POST, PUT, DELETE, Postman ์ค์น ๋ฐ ํ ์คํธ https://hyejin.tistory.com/265 Spring MVC, Mybatis [2].. hyejin.tistory.com ์ฌ๊ธฐ์ ์ค์ตํ๋ ์ฌ์ฉ์ ๊ด๋ฆฌ ๊ฒ์ํ์ ๋ํด์ XML ์๋ต์ ์ฃผ๋ RESTful ์น์๋น์ค ๋ฒ์ ์ผ๋ก ๋ง๋ค์ด๋ณผ๊ฒ์ด๋ค. 1๏ธโฃ JAXB(Java Architecture for XML Binding) JAXB๋ Java ๊ฐ์ฒด๋ฅผ XML๋ก ๋ณํ(์ง๋ ฌํ, M..
2021.12.01 -
Spring ์คํ๋ง java.lang.classnotfoundexception: com.sun.xml.internal.bind.v2.contextfactory ์๋ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ
์ฐ์ ์๋ฐ11์์๋ ํธํ์ฑ์ ๋ฌธ์ ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๊ฝค ๋ง์ด ์ญ์ ๋์๋ค๊ณ ํ๋ค. ๊ทธ๋์ JAXB๋ฅผ ์ฌ์ฉํ๋ ค๋๋ฐ classnotfoundexception์๋ฌ๊ฐ ๋๋ฉด์ ์ฌ์ฉํ ์ ์์๋ค..!! ์ด๋ ๊ฒ ์ธ๊ฐ์ dependency๋ฅผ ์ฐธ์กฐํด์ฃผ์๋๋ @XmlRootElement ์ด๋ ธํ ์ด์ ๋ ์ ์๊ธฐ๊ณ , ์๋ฌ ๋ํ ๋ฐ์ํ์ง ์์๋ค. 1๏ธโฃ JAXB API https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api javax.xml.bind jaxb-api 2.3.1 2๏ธโฃ JAXB Core https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core org.glassfish.jaxb jaxb-core 2.3.0.1 3๏ธโฃ..
2021.12.01 -
Spring MVC ๊ฐ๋จํ ๊ฒ์ํ ๋ง๋ค๊ธฐ (+ ํผ ๋ฐ์ดํฐ ์ ํจ์ฑ ๊ฒ์ฆํ๊ธฐ Validator)
https://hyejin.tistory.com/270?category=1022293 Spring MVC ๊ฐ๋จํ ๊ฒ์ํ ๋ง๋ค๊ธฐ ๊ฐ๋จํ ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค์ด๋ณด๊ณ , ์์ ์ jsp๊ณต๋ถํ ๋ ๋ง๋ค์๋ jdbc ๊ฒ์ํ์ ์์ฉํด Spring MVC ๋ฒ์ ์ผ๋ก ๊ฒ์ํ์ ๋ง๋ค์ด๋ณผ ์์ ์ด๋ค. ์ต์ข ๊ฒฐ๊ณผ ํ๋ฉด์ผ๋ก ๊ธ ์์ฑ, ์์ , ์ญ์ , ์กฐํ๊ฐ hyejin.tistory.com Spring MVC ๊ฒ์ํ ๊ตฌํ์ ์ฌ๊ธฐ์ ์์ธํ ๋ณผ ์ ์๋ค. ์ ๋ฒ์ ํ๋ ๊ฒ์ํ์์๋ ๊ธ ์์ฑ ํผ์์ ์์ฑ์๋ ์ ๋ชฉ ๋ฑ์ ์ ๋ ฅํ์ง ์๊ณ ์ '๋ฑ๋ก' ๋ฒํผ์ ๋๋ฅด๋ฉด ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ํ ์ด๋ธ ์์ฑํ ๋ ์์ฑ์๋ ์ ๋ชฉ์ NOT NULL๋ก ์ค์ ํ๊ธฐ ๋๋ฌธ์ ์๋ฌ๊ฐ ๋ฐ๋ก ๋ฐ์ํ ๊ฒ์ด๋ค. ๊ทธ๋ฌ๋ฏ๋ก ์ด๋ฌํ ์ํฉ์ ๋ฐฉ์งํ๊ธฐ ์ํด์ ๋ง์ฝ ์ฌ์ฉ์๊ฐ ์์ฑ์๋ ์ ๋ชฉ..
2021.12.01 -
Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ๊ฒ์ํ
https://hyejin.tistory.com/272 Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ (@RequestBody, @ResponseBody, GET, POST, PUT, DELETE, Postman ์ค์น ๋ฐ ํ ์คํธ https://hyejin.tistory.com/265 Spring MVC, Mybatis [2] ๊ฐ๋จํ ์ฌ์ฉ์ ๊ฒ์ํ ๋ง๋ค๊ธฐ ๊ทธ๋์ Spring ๊ณต๋ถ๋ฅผ ํ๋ฉด์ ํด์๋ ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ๋ฅผ ์ด์ ๊ฐ๋จํ์ง๋ง ํ๋ฉด ๊ตฌํ๊น์ง ํด์ ๋ง๋ค์ด ๋ณผ ์์ ์ด๋ค. Sp. hyejin.tistory.com ์ฌ๊ธฐ์ ํ๋ ์ฌ์ฉ์ ๊ด๋ฆฌ์ ๋ํด์ RESTful ์น ์๋น์ค ํธ์ถ์ ์ํด Ajax ํต์ ๋ฐฉ๋ฒ์ ์ด์ฉํ ์์ ์ด๋ค. Ajax ํต์ ์ ํ๋ ๋ณต์กํ ์ฝ๋๋ฅผ ๊ฐ๊ฒฐํ๊ฒ ์์ฑํ๊ธฐ ์ํด์ jQuery $.aja..
2021.11.30 -
Spring Ajax, jQuery
1. Ajax (Asynchronous JavaScript and XML) https://hyejin.tistory.com/212?category=1019892 [JS + jquery] Ajax 1. Ajax Ajax(Asynchronous JavaScript and XML) ์ด๋ ๋น๋๊ธฐ ๋ฐฉ์์ Javascript์ xml์ ๊ฐ๋ฅดํจ๋ค. โ ๋๊ธฐ ๋ฐฉ์๊ณผ ๋น๋๊ธฐ ๋ฐฉ์ ๋๊ธฐ ๋ฐฉ์์ ์๋ฒ์ ์ ํธ๋ฅผ ๋ณด๋์ ๋ ์๋ต์ด ๋์์์ผ ๋ค์ ๋์์ ์ํํ ์ ์.. hyejin.tistory.com https://hyejin.tistory.com/213?category=1019892 [JS + jquery] Ajax ๊ด๋ จ ๋ฉ์๋์ Ajax๋ก JSON ๋ฐ์ดํฐ ๋ฐ์ธ๋ฉ, XML ๋ฐ์ดํฐ ๋ฐ์ธ๋ฉ 1. Ajax ๊ด๋ จ ๋ฉ์๋ Ajax๋..
2021.11.30 -
Spring httpmessagenotwritableexception :No converter found for return value of type ์๋ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ
Jackson ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ค์นํ๊ณ RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ๋ฅผ ํ ์คํธํ๋๋ฐ httpmessagenotwritableexception ์ด ์๋ฌ๊ฐ ๋ฐ์ํ๋ค. ๊ตฌ๊ธ๋ง ํด๋ณธ ๊ฒฐ๊ณผ dependency์ jackson-databind ์ jackson core๋ฅผ ์ถ๊ฐํ๋ผ๊ณ ํด์ ํ๋ฒ ํด๋ดค๋๋ ์๋ฌ ํด๊ฒฐ ๋๋ค!! 1๏ธโฃ Jackson core https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core 2๏ธโฃ JackSon databind https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
2021.11.29 -
Spring RESTful ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ (@RequestBody, @ResponseBody, GET, POST, PUT, DELETE, Postman ์ค์น ๋ฐ ํ ์คํธ )
https://hyejin.tistory.com/265 Spring MVC, Mybatis [2] ๊ฐ๋จํ ์ฌ์ฉ์ ๊ฒ์ํ ๋ง๋ค๊ธฐ ๊ทธ๋์ Spring ๊ณต๋ถ๋ฅผ ํ๋ฉด์ ํด์๋ ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ๋ฅผ ์ด์ ๊ฐ๋จํ์ง๋ง ํ๋ฉด ๊ตฌํ๊น์ง ํด์ ๋ง๋ค์ด ๋ณผ ์์ ์ด๋ค. Spring MVC Model2 ๋ฅผ ํ์ฉํด์ ํ ์์ ์ด๋ค. 1. Users ํ ์ด๋ธ Users ํ ์ด๋ธ์ userid, hyejin.tistory.com ์ด ๋ ๋ง๋ค์๋ ๊ฐ๋จํ ์ฌ์ฉ์ ๊ด๋ฆฌ ํ๋ก์ ํธ์ ๋ํด์ Spring RESTful ๊ธฐ๋ฐ์ผ๋ก ๋ง๋ค์ด๋ณผ ์์ ์ด๋ค. https://hyejin.tistory.com/271 Spring REST, RESTful API, XML, JSON , Jackson ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น 1. Open API(Application Prog..
2021.11.29