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

Java19

Spring - DB์ ‘๊ทผ4 (JdbcTemplete) ์ˆœ์ˆ˜ Jdbc์™€ ๋™์ผํ•œ ํ™˜๊ฒฝ์„ค์ •์„ ํ•˜๋ฉด ๋œ๋‹ค. ์Šคํ”„๋ง JdbcTemplate๊ณผ MyBatis ๊ฐ™์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” JDBC API์—์„œ ๋ณธ ๋ฐ˜๋ณต ์ฝ”๋“œ๋ฅผ ๋Œ€๋ถ€๋ถ„ ์ œ๊ฑฐํ•ด์ค€๋‹ค. ํ•˜์ง€๋งŒ SQL์€ ์ง์ ‘ ์ž‘์„ฑํ•ด์•ผ ํ•œ๋‹ค. package hello.hellospring.repository; import hello.hellospring.domain.Member; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.. 2023. 7. 4.
Spring - DB์ ‘๊ทผ3 (์Šคํ”„๋ง ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ) ์Šคํ”„๋ง - ์Šคํ”„๋ง ์ปจํ…Œ์ด๋„ˆ - DB ๋ฅผ ํ†ตํ•ฉํ•˜์—ฌ ํ…Œ์ŠคํŠธ package hello.hellospring.service; import hello.hellospring.domain.Member; import hello.hellospring.repository.MemberRepository; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; import static .. 2023. 7. 4.
Spring - DB์ ‘๊ทผ2 (๊ณ ์ „ jdbc ์ด์šฉ) ๊ณ ์ „ jdbc๋ฅผ ์ด์šฉํ•ด์„œ ์ €์žฅ์†Œ๋ฅผ ์ƒ์„ฑ package hello.hellospring.repository; import hello.hellospring.domain.Member; import org.springframework.jdbc.datasource.DataSourceUtils; import javax.sql.DataSource; import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Optional; public class JdbcMemberRepository implements MemberRepository { private final DataSource dataSource; public Jdbc.. 2023. 7. 4.
Spring - ์Šคํ”„๋ง๋นˆ๊ณผ์˜ ์˜์กด๊ด€๊ณ„2 ์ž๋ฐ” ์ฝ”๋“œ๋กœ ์ง์ ‘ ์Šคํ”„๋ง ๋นˆ ๋“ฑ๋กํ•˜๊ธฐ ./hello.hellospring/SpringConfig.java package hello.hellospring; import hello.hellospring.repository.JdbcTemplateMemberRepository; import hello.hellospring.repository.MemberRepository; import hello.hellospring.repository.MemoryMemberRepository; import hello.hellospring.service.MemberService; import org.springframework.beans.factory.annotation.Autowired; import org.springfram.. 2023. 7. 4.