โญ Personal_Study/Spring10 ์น์์ผ์ ํ์ฉํด ์ค์๊ฐ ์ฑํ ๊ตฌํํ๊ธฐ - Spring ์น์์ผ์ ํ์ฉํด ์ค์๊ฐ ์ฑํ ๊ตฌํํ๊ธฐ - Spring ์น์์ผ์ ํ์ฉํด ์ค์๊ฐ ์ฑํ ๊ตฌํํ๊ธฐ - Springboot ์น์์ผ์ ํ์ฉํด ์ค์๊ฐ ์ฑํ ๊ตฌํํ๊ธฐ - React ์น์์ผ์ด๋ โ WebSocket์ ์ค์๊ฐ ์๋ฐฉํฅ ํต์ ์ ์ํ ํ๋กํ ์ฝ์ ์ผ์ข ์ด๋ค. WebSocket์ ๊ธฐ๋ณธ์ ์ผ๋ก TCP ํ๋กํ ์ฝ์ ์ฌ์ฉํ๋ฉฐ, ํธ๋์์ดํฌ ๊ณผ์ ์ ํตํด ์ฐ๊ฒฐ์ ์๋ฆฝํ ํ, ์ง์์ ์ธ ์ฐ๊ฒฐ์ ํตํด ์๋ฐฉํฅ ํต์ ์ด ๊ฐ๋ฅํ๊ฒ ๋๋ค. ์ฃผ๋ก ์ค์๊ฐ ์ฑํ , ๊ฒ์ ๋ฑ์ ๋ง์ด ์ฐ์ธ๋ค ์น์์ผ์ ์ฅ์ ๋ฐ ํน์ง (vs HTTP) โ ์น์์ผ์ ํต์ฌ ํค์๋๋ ์ง์์ ์ธ ์ฐ๊ฒฐ์ด๋ค. ์น์์ผ์ ์ฅ์ ๊ณผ ํน์ง์ HTTP์ ๋น๊ตํ์ ๋ ๋ช ํํด์ง๋ค. ์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉ๋๋ HTTP๋ stateless, connectionless๋ผ๋ ํน์ง์ผ๋ก ์ธํด ์ค์๊ฐ์ผ๋ก ์๋ฐฉํฅ ํต์ ์ .. 2023. 4. 23. JPA์์ Wrapper class vs primitive type JPA์์ ์ํฐํฐ๋ฅผ ์์ฑํ ๋ Wrapper class๋ฅผ ์ฌ์ฉํด์ผํ ๊น primitive type์ ์ฌ์ฉํด์ผํ ๊น? @Entity public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private int stock; // Integer? int? } ๋ค์ ์ํฉ์์ stock์ int๋ก ์์ฑํด์ผ๋ ๊น Integer๋ก ์์ฑํด์ผ๋ ๊น? 1. primitive type & Wrapper Class ์์ ํ์ (primitive type) โ Java์์ ๊ธฐ๋ณธ์ผ๋ก ์ ๊ณต๋๋ ๋ฐ์ดํฐ ํ์ โ int, byte, short, long, float, double, boole.. 2023. 4. 17. Page ๊ฐ์ฒด์ Collections ๋ฉ์๋๋ฅผ ์ ์ฉํ์ ๋ UnsupportedOperationException ๋ฐ์ ์๋ฌ JPA์ Page๋ immutableํ ๊ฐ์ฒด๋ฅผ ๋ฐํํ๊ธฐ ๋๋ฌธ์ Collections.shuffle๋ฑ ์๋ณธ ๊ฐ์ฒด์ ๊ฐ์ ๋ณ๊ฒฝํ๋ ๋ฉ์๋๋ฅผ ์ ์ฉํ ๊ฒฝ์ฐ UnsupportedOperationException ์๋ฌ๊ฐ ๋ฐ์ํ๋ค ๋ถ๋ช ํ ํ์ ๋ List๊ณ ๊ฐ๋ ์ถ๋ ฅ๋๋๋ฐ ์๋ฌ๊ฐ ๋ฐ์ํด ์์ธ์ ์ฐพ์๋ด๊ธฐ๊น์ง ์ ๋ฒ ๊ณ ์ํ์๋ค. Page ๊ฐ์ฒด์ ์๋ณธ ๊ฐ์ ๋ณ๊ฒฝ์ํค๋ ๋ฉ์๋๋ฅผ ์ ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ ๋ค์ ์คํธ๋ฆผ์ผ๋ก ๋นผ์ List๋ฅผ ๋ง๋ค์ด์ฃผ๋ฉด mutableํ list๊ฐ ๋์ด ๋ฉ์๋๋ฅผ ์ ์ฉํ ์ ์๋ค. 2023. 3. 30. ๋น ์๋ช ์ฃผ๊ธฐ ์ฝ๋ฐฑ ๋น ์๋ช ์ฃผ๊ธฐ ์ฝ๋ฐฑ 1. ๋น ์๋ช ์ฃผ๊ธฐ ์ฝ๋ฐฑ ์์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ปค๋ฅ์ ํ, ๋คํธ์ํฌ ์์ผ ๋ฑ ์ ํ๋ฆฌ์ผ์ด์ ์์ ์์ ์ ํ์ํ ์ฐ๊ฒฐ์ ๋ฏธ๋ฆฌ ํด๋๊ณ , ์ข ๋ฃ ์์ ์ ์ฐ๊ฒฐ์ ๋ชจ๋ ์ข ๋ฃํ๋ ์์ ์ ์งํํ๋ ค๋ฉด ๊ฐ์ฒด์ ์ด๊ธฐํ์ ์ข ๋ฃ ์์ ์ด ํ์ํ๋ค ์์ ์ฝ๋ // NetworkClient.java public class NetworkClient { private String url; public NetworkClient() { System.out.println("์์ฑ์ ํธ์ถ, url = " + url); connect(); call("์ด๊ธฐํ ์ฐ๊ฒฐ ๋ฉ์์ง"); } public void setUrl(String url) { this.url = url; } // ์๋น์ค ์์์ ํธ์ถ public void connect() { .. 2023. 1. 10. ์์กด๊ด๊ณ ์๋ ์ฃผ์ ์์กด๊ด๊ณ ์๋ ์ฃผ์ 1. ๋ค์ํ ์์กด๊ด๊ณ ์ฃผ์ ๋ฐฉ๋ฒ ์์ฑ์ ์ฃผ์ (constructor) โ ์์ ์ ์ฃผ์ (setter) ํ๋ ์ฃผ์ ์ผ๋ฐ ๋ฉ์๋ ์ฃผ์ 1. ์์ฑ์ ์ฃผ์ ์์ฑ์ ํธ์ถ ์์ ์ ๋ฑ 1๋ฒ๋ง ํธ์ถ๋๋ ๊ฒ ๋ณด์ฅ โ ๋ถ๋ณ, ํ์ ์์กด๊ด๊ณ์ ์ฌ์ฉ // OrderServiceImpl.java @Component public class OrderServiceImpl implements OrderService{ // final -> ๋ฐ๋์ ๊ฐ์ ํ ๋นํด์ค์ผํ๋ค.(ํ์, ๋ถ๋ณ) private final MemberRepository memberRepository; private final DiscountPolicy discountPolicy; @Autowired // ์์ฑ์๊ฐ ํ ๊ฐ๋ง ์์ ๊ฒฝ์ฐ ์๋ตํด๋ ๋๋ค. p.. 2023. 1. 9. ComponentScan ์ปดํฌ๋ํธ ์ค์บ ์ปดํฌ๋ํธ ์ค์บ & ์์กด๊ด๊ณ ์๋์ฃผ์ ๋งค๋ฒ @Bean์ด๋ XML ํ์ผ๋ก ์คํ๋ง ๋น์ ์ง์ ๋ฑ๋กํด์ฃผ๋ฉด ๋งค์ฐ ๋ฒ๊ฑฐ๋ก์ โ ์ปดํฌ๋ํธ ์ค์บ: ์ค์ ์ ๋ณด๊ฐ ์์ด๋ ์๋์ผ๋ก ์คํ๋ง๋น์ ๋ฑ๋กํด์ฃผ๋ ๊ธฐ๋ฅ โ ์์กด ๊ด๊ณ ์๋ ์ฃผ์ : @Autowired package hello.core; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.FilterType; @Configuration @ComponentScan( excludeFilters = @ComponentS.. 2023. 1. 7. ์ด์ 1 2 ๋ค์