๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

๊ฐœ๋ฐœ93

[JPA] @OnDelete VS cascade = CascadeType.REMOVE ๊ด€๊ณ„ํ˜• DB์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” @OnDelete์™€ cascade = CascadeType.REMOVE์˜ ์ฐจ์ด๋ฅผ ์•Œ์•„๋ณด์ž! @OnDelete DDMS ๋ ˆ๋ฒจ์—์„œ ์ž‘๋™ @OnDelete(action = OnDeleteAction.CASCADE) DDL ์ƒ์„ฑ์‹œ cascade ์ œ์•ฝ ์กฐ๊ฑด์ด ์ƒ์„ฑ ๋จ. ์—ฌ๊ธฐ์„œ DDL์ด๋ž€ Data Definition Language๋กœ ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค๋ฅผ ์ •์˜ํ•˜๋Š” ์–ธ์–ด์ด๋ฉฐ, CREATE, ALTER, DROP, TRUNCATE๋ฅผ ๋งํ•œ๋‹ค. casecade=CascadeType.REMOVE JPA ๋ ˆ๋ฒจ์—์„œ ์ž‘๋™ JPA๊ฐ€ ๋ถ€๋ชจ ์—”ํ‹ฐํ‹ฐ๋ฅผ ์‚ญ์ œํ•  ๋•Œ ์—ฐ๊ด€๋œ ์ž์‹ ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ DELETE ์ฟผ๋ฆฌ๋ฅผ ์‹คํ–‰ ํ•จ ๋ณธ์ธ์˜ ๊ฒฝ์šฐ ๋ถ€๋ชจ์™€ ์ž์‹์˜ 1:N ๊ด€๊ณ„์ผ ๋•Œ ์•„๋ž˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ์ถฉ์กฑ์‹œ์ผœ์•ผ ํ–ˆ๋‹ค. ์š”๊ตฌ.. 2021. 12. 13.
[JAVA] VO๋ฅผ JSON ๋ฐ์ดํ„ฐ๋กœ ๋ณ€ํ™˜ (java class to json, vo to json) ๋จผ์ € ์•„๋ž˜ ํฌ์ŠคํŒ…์„ ๋ณด๊ณ  ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•˜์ž! [JAVA] JSON ๋ฐ์ดํ„ฐ๋ฅผ VO๋กœ ํŒŒ์‹ฑ, ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ• (json to java class) ๋จผ์ € jackson-databind ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค! spring boot์˜ ๊ฒฝ์šฐ 'spring-boot-starter-web'์— ํฌํ•จ๋˜์–ด ์žˆ์Œ maven com.fasterxml.jackson.core jackson-databind 2.13.0 gradle // https://mvnrepos.. ynzu-dev.tistory.com vo ์˜ˆ์‹œ public class TestVo { @JsonProperty("user-name") private String userName; @JsonProperty("user-id") private Stri.. 2021. 12. 9.
[JAVA] JSON to VO : JSON์˜ key์™€ vo(java class)์˜ ๋ณ€์ˆ˜๋ช…์ด ๋‹ค๋ฅผ ๊ฒฝ์šฐ ์•ž ํฌ์ŠคํŒ…์—์„œ json ๋ฐ์ดํ„ฐ๋ฅผ vo๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด์•˜๊ณ , ์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„  json์˜ key์™€ vo์˜ ๋ณ€์ˆ˜๋ช…์ด ๋‹ค๋ฅผ ๊ฒฝ์šฐ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ฒ ๋‹ค. json์˜ key์™€ vo์— ์„ ์–ธ๋œ ๋ณ€์ˆ˜๋ช…์ด ๋‹ค๋ฅผ ๊ฒฝ์šฐ ๋ณ€ํ™˜์‹œ key์˜ ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•˜์—ฌ ํŒŒ์‹ฑํ•˜๋ ค๋ฉด @JsonProperty์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. json data ์˜ˆ์‹œ {"user-name":"name01", "user-id":"id01"} vo ์˜ˆ์‹œ public class TestVo { @JsonProperty("user-name") private String userName; @JsonProperty("user-id") private String userId; } ์ด๋ ‡๊ฒŒ vo์˜ ๋ณ€์ˆ˜๋ช…์— JsonProperty ์–ด๋…ธํ…Œ์ด์…˜๊ณผ ํ•จ๊ป˜ ๋งคํ•‘ํ•  json d.. 2021. 12. 9.
[JAVA] JSON ๊ฐ์ฒด VO ๋ณ€ํ™˜ ์—๋Ÿฌ : org.codehaus.jackson.map.exc.UnrecognizedPropertyException json ๋ฐ์ดํ„ฐ๋ฅผ vo๋กœ ๋ณ€ํ™˜ํ•  ๋•Œ ํ•ด๋‹น ํด๋ž˜์Šค์— ์„ ์–ธ๋˜์ง€ ์•Š์€ ๋ณ€์ˆ˜(ํ”„๋กœํผํ‹ฐ)๊ฐ€ json์— ์žˆ์œผ๋ฉด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. org.codehaus.jackson.map.exc.UnrecognizedPropertyException ํ•ด๋‹น ํ”„๋กœํผํ‹ฐ๋ฅผ ๋ฌด์‹œํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒฝ์šฐ @JsonIgnoreProperties(ignoreUnknown = true)๋ฅผ ์„ ์–ธํ•˜๋ฉด ๋œ๋‹ค! @JsonIgnoreProperties(ignoreUnknown = true) public class TestVo { private String userName; private String userId; } json ๋ฐ์ดํ„ฐ๊ฐ€ ์•„๋ž˜์™€ ๊ฐ™์ด ๋“ค์–ด์™€๋„ ์ด์ œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค. {"user-name":"name01", "user-id":"id01", "u.. 2021. 12. 9.
[JAVA] JSON ๋ฐ์ดํ„ฐ๋ฅผ VO๋กœ ํŒŒ์‹ฑ, ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ• (json to java class) ๋จผ์ € jackson-databind ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค! spring boot์˜ ๊ฒฝ์šฐ 'spring-boot-starter-web'์— ํฌํ•จ๋˜์–ด ์žˆ์Œ maven com.fasterxml.jackson.core jackson-databind 2.13.0 gradle // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.0' ์œ„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ–ˆ์œผ๋ฉด ์ด ๋‘์ค„๋กœ ์‰ฝ๊ฒŒ ํŒŒ์‹ฑ์ด ๊ฐ€๋Šฅํ•˜๋‹ค! ObjectMapper mapper = new ObjectM.. 2021. 12. 9.
[Spring Boot] spring security - CSRF ์ ์šฉ , +) ajax csrf ์ ์šฉ 1. gradle ํ˜น์€ maven์— 'spring-boot-starter-security' ์ถ”๊ฐ€ implementation 'org.springframework.boot:spring-boot-starter-security' org.springframework.boot spring-boot-starter-security 2.5.5 Spring Security๋Š” ์Šคํ”„๋ง ๊ธฐ๋ฐ˜์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ณด์•ˆ์„ ๋‹ด๋‹นํ•˜๋Š” ํ”„๋ ˆ์ž„์›Œํฌ๋กœ Spring Security๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ณด์•ˆ์ฒ˜๋ฆฌ๋ฅผ ๊ฐ„๋‹จํ•˜๋ฉด์„œ ๊ฐ•๋ ฅํ•˜๊ฒŒ ๊ตฌํ˜„๊ฐ€๋Šฅํ•˜๋‹ค! 2. XXXXApplication.java์— @EnableWebSecurity ์„ ์–ธ @EnableWebSecurity :Spring Security๋ฅผ ํ™œ์„ฑํ™” @EnableWebSecurity @SpringBoot.. 2021. 12. 7.
[softhsm] windows์— softhsm2 ์„ค์น˜ ๋ฐ ์„ธํŒ… 1. softhsm ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜ https://sourceforge.net/projects/softhsm4windows SoftHSM for Windows Download SoftHSM for Windows for free. SoftHSM installer for MS Windows. Binary builds and MSI installers of SoftHSM for MS Windows platform. Please visit project website - https://github.com/disig/SoftHSM2-for-Windows - for more information. sourceforge.net 2. ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ธํŒ… ์„ค์น˜ ๊ฒฝ๋กœ/README.txt ํŒŒ์ผ ์ฐธ์กฐ ์‹œ์Šคํ…œ ๋ณ€์ˆ˜์— SOFTHSM.. 2021. 12. 6.
[Spring Boot] mybatis ์ ์šฉํ•˜๊ธฐ 1.gradle ํ˜น์€ maven์— 'mybatis-spring-boot-starter' ์ถ”๊ฐ€ compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.4") org.mybatis.spring.boot mybatis-spring-boot-starter 2.1.4 2. application.yml์— mybatis ์„ค์ • ํŒŒ์ผ(mybatis-config.xml) ๋ฐ xml ํŒŒ์ผ ์„ธํŒ… mybatis: config-location: classpath:mybatis-config.xml mapper-locations: classpath:mapper/postgresql/*.xml 3. mybatis-config.xml 4. postgresql/*.xml SELE.. 2021. 12. 6.
728x90
๋ฐ˜์‘ํ˜•