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

spring8

[Spring] @Transactional์ด ์ ์šฉ๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ(๋กค๋ฐฑ์ด ์•ˆ๋˜๋Š” ์ด์œ ) 1. Checked Exception์ผ ๊ฒฝ์šฐ ์‚ฌ์‹ค ์ด ํ•ญ๋ชฉ์— ๋Œ€ํ•œ ์„ค๋ช…์„ ์œ„ํ•ด ์–ด์ œ java์˜ error์™€ exception์— ๋Œ€ํ•ด ํฌ์ŠคํŒ…์„ ํ–ˆ๋‹ค. Checked Exception์ด ๋ญ”์ง€ ๋ชจ๋ฅธ๋‹ค๋ฉด ๋จผ์ € ์•„๋ž˜ ํฌ์ŠคํŒ…์„ ๋ณด๊ณ  ์˜ค๋Š” ๊ฒƒ์„ ์ถ”์ฒœ! [Java] Error, Checked Exception, Unchecked Exception ๋น„๊ต ์ž๋ฐ”์—์„œ๋Š” ์˜ˆ์™ธ๋ฅผ ํฌ๊ฒŒ Error์™€ Exception์œผ๋กœ ๊ตฌ๋ถ„ํ•˜๊ณ , Exception์€ RuntimeException ์ƒ์† ์—ฌ๋ถ€์— ๋”ฐ๋ผ Checked Exception, Unchecked Exception์œผ๋กœ ๊ตฌ๋ถ„๋œ๋‹ค. Error ์‹œ์Šคํ…œ์— ๋น„์ •์ƒ์ ์ธ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•œ ๊ฒฝ.. ynzu-dev.tistory.com Checked Exception๋Š” ์˜ˆ์™ธ์ƒํ™ฉ ๋ฐœ์ƒ์‹œ ๋กค๋ฐฑ์ฒ˜๋ฆฌ๋ฅผ ํ•˜.. 2022. 1. 13.
[Log] ๋กœ๊ทธ ํŒŒ์ผ ๋ถ„๋ฆฌํ•˜๊ธฐ - Log4j, Logback ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ๋„์ค‘ ํŠน์ • ์„œ๋น„์Šค๋งŒ ๋กœ๊ทธ ํŒŒ์ผ์„ ๋ถ„๋ฆฌํ•ด์„œ ์ €์žฅํ•ด์•ผ๋  ์ผ์ด ์žˆ์–ด ์•„๋ž˜์™€ ๊ฐ™์ด ์ˆ˜์ •ํ•˜์˜€๋‹ค. ์ˆ˜์ • ์ „ org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BasicService.class.getName()); logger.info("๋กœ๊ทธ ๋‚ด์šฉ"); ์ˆ˜์ • ํ›„ org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BasicService.class.getName()); org.slf4j.Logger regLogger = org.slf4j.LoggerFactory.getLogger("RegLogger"); logger.info("๋กœ๊ทธ ๋‚ด์šฉ"); regLogger.info("๋กœ๊ทธ ๋‚ด์šฉ"); ๋ถ„๋ฆฌํ•ด.. 2021. 12. 22.
[Spring Framework] CSRF ์ ์šฉ ์ง€๋‚œ ๋ฒˆ์— spring boot์— csrf๋ฅผ ์ ์šฉํ•˜๋Š” ํฌ์ŠคํŒ…์„ ์˜ฌ๋ ธ์—ˆ๋Š”๋ฐ ๊ทธ๋ƒฅ spring๊ณผ ์ ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋‹ฌ๋ผ ๋˜ ํฌ์ŠคํŒ…์„ ์˜ฌ๋ ค๋ณธ๋‹ค! [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 S.. ynzu-dev.tistory.com web.xml์— dispactcher servlet์„ ๋“ฑ๋กํ•œ๋‹ค. appServlet.. 2021. 12. 14.
[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.
IT ๊ธฐ์—…๋“ค์˜ ๊ธฐ์ˆ  ์Šคํƒ ๋ฐ ๊ธฐ์ˆ  ๋ธ”๋กœ๊ทธ ํ•œ๋ˆˆ์— ๋ณด๋Š” ์‚ฌ์ดํŠธ ๊ณต์œ ! ๋„ค์นด๋ผ์ฟ ๋ฐฐ๋Š” ๋ฌผ๋ก  ํ† ์Šค, ๋‹น๊ทผ๋งˆ์ผ“, ๋งˆ์ผ“์ปฌ๋ฆฌ ๋“ฑ ํ•ซํ•œ ๊ธฐ์—…๋“ค์˜ ๊ธฐ์ˆ  ์Šคํƒ๊ณผ ๊ธฐ์ˆ  ๋ธ”๋กœ๊ทธ๋ฅผ ์•„๋ž˜ ์‚ฌ์ดํŠธ์—์„œ ํ•œ๋ˆˆ์— ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค! ๋ชฉํ‘œ ๊ธฐ์—…์˜ ๊ธฐ์ˆ  ์Šคํƒ์„ ๋ฏธ๋ฆฌ ํŒŒ์•…ํ•ด์„œ ์ค€๋น„ํ•  ์ˆ˜ ์žˆ์–ด์„œ ์ข‹์€ ๋“ฏ! ๊ทธ๋ฆฌ๊ณ  ์ปจํผ๋Ÿฐ์Šค ์ผ์ •, ์Šคํƒ ์ธ๊ธฐ๋„๋„ ํ™•์ธ ๊ฐ€๋Šฅํ•˜๋‹ค.. node.js๋ฅผ ๊ณต๋ถ€ํ•ด์•ผ๊ฒ ๋‹ค.. ๊ณต๋ถ€ํ• ๊ฒŒ ๋„ˆ๋ฌด ๋งŽ๋„ค์š”.. +) ์ตœ๊ทผ ์ถ”๊ฐ€๋œ ๊ธฐ์—…๋„ ํŒ์—…์œผ๋กœ ์•Œ๋ ค์ค€๋‹ค. ๊ธ€์„ ์ž‘์„ฑ ํ•˜๋Š” ์‹œ์ ์—๋Š” ๋‘๋“ค๋ฆฐ, ์˜ด๋‹ˆ์–ด์Šค, ์—์ด์•„์ดํŠธ๋ฆญ์Šค ๊ธฐ์—…์ด ์ถ”๊ฐ€๋๋‹ค! ์Šคํƒ€ํŠธ์—…๋“ค์˜ ๊ธฐ์ˆ  ์Šคํƒ๊ณผ ๊ธฐ์ˆ  ๋ธ”๋กœ๊ทธ๋ฅผ ํ•œ๋ˆˆ์— ์‚ดํŽด๋ณด์„ธ์š” | ์ฝ”๋“œ๋„ˆ๋ฆฌ ๋„ค์ด๋ฒ„, ์นด์นด์˜ค, ํ† ์Šค, ๋‹น๊ทผ๋งˆ์ผ“๊ณผ ๊ฐ™์ด ์š”์ฆ˜ ํ•ซํ•œ ์Šคํƒ€ํŠธ์—…์€ ์–ด๋–ค ๊ธฐ์ˆ  ์Šคํƒ์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์„๊นŒ์š”? ์ฝ”๋“œ๋„ˆ๋ฆฌ์—์„œ ๊ตญ๋‚ด 100๊ฐœ๊ฐ€ ๋„˜๋Š” ์Šคํƒ€ํŠธ์—…์˜ ๊ธฐ์ˆ  ์ •๋ณด๋ฅผ ํ™•์ธํ•˜์„ธ์š”. www.codenary.co.kr 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.
[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.
[Spring] Scheduler(์Šคํ”„๋ง ์Šค์ผ€์ค„๋Ÿฌ) ์„ค์ •ํ•˜๊ธฐ ์Šคํ”„๋ง์—์„œ ํŠน์ • ์‹œ๊ฐ„ ํ˜น์€ ๋ช‡ ๋ถ„, ๋ช‡ ์‹œ๊ฐ„ ๋งˆ๋‹ค ๊ธฐ๋Šฅ์„ ๋™์ž‘ ์‹œํ‚ค๋ ค๋ฉด Spring์—์„œ ์ œ๊ณตํ•˜๋Š” scheduler๋ฅผ ์ด์šฉํ•˜๋ฉด ๋œ๋‹ค. (Spring 3.1๋ถ€ํ„ฐ๋Š” Quartz์—†์ด ๊ฐ„๋‹จํ•˜๊ฒŒ ์Šค์ผ€์ค„๋Ÿฌ ๊ตฌํ˜„์ด ๊ฐ€๋Šฅํ•˜๋‹ค.) โ€‹ ๋จผ์ € applicationContext์— ์Šค์ผ€์ค„๋Ÿฌ๋ฅผ ๋“ฑ๋กํ•œ๋‹ค. (Component Scan์ด ์„ ์–ธ๋˜์–ด ์žˆ๋Š” ํŒŒ์ผ) applicationContext.xml (์š”์•ฝ) => testJob์˜ doJob ๋ฉ”์†Œ๋“œ๋ฅผ 30๋ถ„๋งˆ๋‹ค ์‹คํ–‰ํ•˜๋Š” ์Šค์ผ€์ค„๋Ÿฌ๋ฅผ ๋“ฑ๋กํ–ˆ๋‹ค. testJob์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค. TestJob.java @Service("testJob") public class TestJob { public synchronized void doJob() { System.out.println("###########.. 2021. 11. 30.
728x90
๋ฐ˜์‘ํ˜•