๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Spring Boot + MyBatis ์„ค์ • ๋ฐฉ๋ฒ•(HikariCP, H2) Spring Boot + MyBatis ์„ค์ • ๋ฐฉ๋ฒ•(HikariCP, H2) ๐Ÿ“ ์ˆœ์„œ 1. ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ 2. ์ดˆ๊ธฐํ™” ์Šคํฌ๋ฆฝํŠธ ์„ค์ •(schema.sql, data.sql) 3. DBCP/DataSource ์„ค์ •(HikariCP) 4. MyBatis ์„ค์ •(@MapperScan, XML ์œ„์น˜, CamelCase, Alias, ๋กœ๊ทธ๋ ˆ๋ฒจ) 5. Model, Mapper ์ƒ์„ฑ 6. ํ…Œ์ŠคํŠธ 1. ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ MyBatis๋ฅผ ์ด์šฉํ•œ DB ์—ฐ๋™์„ ์œ„ํ•œ ์ƒˆ ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ๋Š” IDE๋ฅผ ์ด์šฉํ•˜๋˜์ง€, spring initializr(start.spring.io)๋ฅผ ์ด์šฉํ•ด ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. ์ž๋ฐ”๋Š” 8๋กœ, ์˜์กด์„ฑ์€ Spring Web, Spring Data JDBC.. 2020. 8. 1.
[Spring Boot] ApplicationRunner ๋“ฑ๋ก ๋ฐฉ๋ฒ• ์ •๋ฆฌ [Spring Boot] ApplicationRunner ๋“ฑ๋ก ๋ฐฉ๋ฒ• ์ •๋ฆฌ 1. ๋ณ„๋„์˜ ํด๋ž˜์Šค์— @Component ๋ถ™์—ฌ์„œ ๋“ฑ๋กํ•˜๊ธฐ import org.springframework.boot.ApplicationArguments; import org.springframework.stereotype.Component; @Component public class ApplicationRunner implements org.springframework.boot.ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { // ์ฝ”๋“œ ์ž‘์„ฑ } } 2. @Configuration ํด๋ž˜์Šค์— @Bean์œผ๋กœ ์ง์ ‘ ๋“ฑ๋กํ•˜๊ธฐ .. 2020. 3. 26.