전체 글
-
Docker (2) - 이미지와 컨테이너Infra/Docker 2024. 1. 24. 21:10
1. 이미지 - 일반적으로 프로그램을 실행시키기 위해선 위와 같은 환경이 조성되어야 한다. - 이미지는 특정 시점의 어플리케이션을 구동할 수 있는 환경을 압축하여 저장해 둔 것이다. - 도커를 사용한다는 것은 컨테이너 안에서 특정 소프트웨어를 운영한다는 것이다. - 컨테이너는 이미지를 통해 실행 될 수 있다. - 이미지 자체는 압축파일로 용량만 차지하고, 이를 컨테이너를 통해서 실행하면 cpu,메모리등의 리소스를 사용하기 시작한다. - 비유하자면, 이미지는 게임의 실행 파일이고, 실행 파일을 눌렀을 때 시작되는 프로세스를 컨테이너로 볼 수 있다. - 하나의 이미지에 여러 컨테이너를 실행시킬 수 있다. 컨테이너 실행시 이미지를 복사해 격리된 디스크 공간을 생성한다. * 사용하는 입장에서 컨테이너는 그냥 하..
-
Docker (1) - 가상화 기술Infra/Docker 2024. 1. 24. 20:35
1. 엔터프라이즈 환경에서 구동되는 다양한 서버 - 서버는 일반적으로 하드웨어에서 실행 중인 소프트 웨어를 지칭한다. - 서버는 서버에서 어떤 소프트웨어가 실행되느냐에 따라 나눌 수 있다. (파일공유 소프트웨어(파일서버), RDB 소프트웨어(DB서버) - 서버는 이미 만들어진 소프트웨어를 다운받아 구성되거나, 소스코드로 개발된 애플리케이션 서버가 있다. - 엔터프라이즈 환경에선 다양한 서버가 운영되는데, 운영방식에 따라 베어메탈,하이퍼바이저,컨테이너 형식으로 나눌 수 있다. > 베어메탈: 일반적으로 컴퓨터를 사서 프로그램을 실행한다. 서버 컴퓨터를 구입하고, 여러개의 소프트웨어를 구동한다. > 하이퍼바이저: 하나의 컴퓨터의 리소스를 공유하는 가상환경을 만들고 그 위에서 각각의 서버 소프트웨어를 운용한다...
-
JPA (11) - 다형성 쿼리,엔티티 직접 사용,정적쿼리,벌크연산Web/JPA 2024. 1. 12. 14:40
1. 다형성 쿼리 - TYPE > 조회 대상을 특정 자식으로 한정 (ex Item 중에 Book, Movie를 조회하라) select i from Item i where type(i) IN (Book, Movie) > 자바의 타입 캐스팅과 유사하다. > 상속 구조에서 부모 타입을 특정 자식 타입으로 다룰 때 사용 (FROM, WHERE, SELECT에서 사용) select i from Item i where treat(i as Book).author = 'kim' 2. 엔티티 직접 사용 > JPQL에서 엔티티를 직접 사용하면 SQL에서 해당 엔티티 기본 키 값을 사용한다. select count(m.id) from Member m //엔티티 아이디를 사용 select count(m) from Member..
-
JPA 활용 (1) - 프로젝트 환경설정Web/JPA 2024. 1. 4. 14:24
1. spring boot (build.gradle) > java 17버전 > dependencies: spring-data-jpa, thymeleaf, validation,spring-web, h2 > gradle은 의존관계 추가하면, 그 의존관계에 필요한 모든 의존관계 자동으로 끌어온다. > ./gradlew dependencies -configuration complieClasspath를 보면 의존관계 라이브러리 살펴볼 수 있음 * dependencies 추가하면서, version이 없는 것은 , plugins에 작성된 것은 2. H2 데이터 베이스 설치 > jdbc:h2:~/jspshop (최소한번) -> 한번 들어가줘야함 파일 모드로 들어가기 > ~/jpashop.mv.db -> 파일 생성 한번..
-
자바스터디(1)언어/JAVA 2023. 10. 18. 01:00
1. 절차지향 to 객체지향 - 과거의 프로그래밍은 절차지향적이었다. 다른 말로 프로세스 지향적이었다. - 데이터를 조작하는 코드를 별도로 분리(함수 혹은 프로시저)로 쪼개고 각 프로시저들이 데이터를 조작하는 방식이다. - 각 프로시저는 다른 프로시저를 사용할 수 있고, 각 프로시저는 같은 데이터를 사용할 수 있다.(프로시저간 데이터 공유) ex) 평균 계산 프로그램 : 각 과목 점수 데이터 읽어서 합+평균구하기(함수1) -> 화면출력(함수2) 이때 각 프로시저는 데이터를 공유하는 방식 -> 데이터 중심적 구현 - 프로세스를 한눈에 볼 수 있다는 장점이 있지만 명백한 한계점이 존재한다. 1. 프로그램 규모가 커지면, 함수가 너무 많이 증가 2. 데이터 이름 의미 등등 변경이 생기면 함수를 하나씩 다 수정..
-
자바 네트워크 네트워크 입출력 (1) - TCP언어/JAVA 2023. 8. 22. 19:19
1. 네트워크 기초 - 네트워크는 여러 컴퓨터들을 통신 회선으로 연결하는 것 - LAN은 가정,회사,건물,특정 영역에 존재하는 컴퓨터 연결 - WAN은 LAN을 연결한 것이다. (WAN이 흔히 말하는 인터넷이다) - LAN과 LAN을 라우터가 연결 - 라우터와 LAN은 스위치로 연결 1.2 서버와 클라이언트 - 네트워크에서 유무선으로 컴퓨터가 연결되어 있다면, 실제로 데이터 주고받는 행위는 프로그램들이 한다. - 서비스를 제공하는 프로그램을 서버, 서비스 요청하는 프로그램을 클라이언트라 부른다. - 인터넷을 통해서 두 프로그램이 통신하기 위해서는 클라이언트가 서비스 요청, 서버는 처리 결과 응답으로 제공한다. 1.3 ip주소 - 컴퓨터의 고유주소이다. 컴퓨터마다 받는 것이 아니라, 네트워크 어답터(LAN..
-
스프링 핵심 원리 (4) - 컴포넌트 스캔Web/Spring 2023. 8. 18. 03:56
1. 컴포넌트 스캔과 의존관계 자동 주입 - 스프링 빈을 등록할 때 자바코드나 Xml을 통해 설정 정보를 직접 등록했음 - 설정 정보 없이 자동으로 스프링 빈을 등록하는 컴포넌트 스캔이라는 기능 있다. - 의존관계 자동 주입하는 @Autowired 기능도 제공한다. @Configuration @ComponentScan public class AutoAppConfig{ } > 컴포넌트 스캔을 사용하려면, 설정 정보에 @ComponentScan을 붙여주면 된다. > @Component 어노테이션이 붙은 클래스를 스캔해서 스프링 빈으로 등록한다. @Configuration도 스캔 대상이다. @Component public class MemoryMemberRepository implements MemberRep..
-
스프링 핵심 원리 (3) - 싱글톤 컨테이너Web/Spring 2023. 8. 17. 15:22
1. 스프링 컨테이너의 이점 (싱글톤) 1.1 앱 어플리케이션과 싱글톤 - 스프링은 기업용 온라인 서비스 기술을 지원하기 위해 탄생 - 스프링 어플리케이션은 대부분 웹 어플리케이션임 - 웹 어플리케이션은 보통 여러 고객이 동시 요청한다. AppConfig appConfig = new AppConfig() MemberService memberService1 = appConfig.memberService(); MemberService memberService2 = appConfig.memberService(); - 설정 클래스인 순수 DI 컨테이너 AppConfig를 사용해서 memberService를 생성해보자 - memberService()메서드는 내부적으로 생성자를 사용하여 구현체를 생성하므로, 요청시..