Spring 66

Spring boot 개요

스프링 부트는 단독 실행 할수 있고, 상용화 수준의 실행 가능한 스프링 기반 애플리케이션을 쉽게 생성 java -jar command OR 전통적인 war로 배포 가능한 자바 애플리케이션 생성에 스프링 부트를 사용 가능 내장된 Tomcat, Jetty, Undertow를 이용해 war 배포 없이 웹 애플리케이션을 실행 가능 ==> 기존에 web app을 위해 tomcat에 설정하던 것을 자동으로 해줌 많이 사용하는 라이브러리를 모아 놓은 start POM 파일을 제공하여 쉽게 라이브러리를 관리 @SpringBootApplication == @Configuration + @EnableAutoConfiguration + @ComponentsScan Spring boot Starter 종류 Spring boo..

Spring 2023.01.20

Spring 용어 정리

bean 이란 스프링이 IoC 방식으로 관리하는 객체로 Managed Object라고도 함 스프링이 직접 생성과 제어를 담당하는 object만을 bean이라고 함 IoC 컨테이너는 빈의 생성과 제어의 관점에서 Bean Factory라고도 함 bean factory는 spring이 IoC를 담당하는 핵심 컨테이너로 빈을 등록, 생성, 조회, 반환 등의 관리 기능을 담당 일반적으로 이 bean factory를 사용하지 않고 이를 확장한 application context를 사용함. application context는 스프링이 제공하는 애플리케이션 지원 기능을 모두 포함 bean factory를 확장한 IoC 컨테이너로 bean을 등록하고 관리하는 기본 기능은 bean factory와 동일함 스프링이 제공하..

Spring 2023.01.20

06. service logic 구현

mapstore에서 구성한 내용을 DI를 통해 spring에서 주입 받아(DI) 이를 사용해서 서비스를 구현 실제 DI 때에는 구현체는 없고 interface만으로 구현하여 유연성을 갖음 실제 서비스에서 사용하는 class로 map store보다 세부적인 내용을 구현 @Service("clubService") public class ClubServiceLogic implements ClubService { // 인터페이스만 정의함, 사용 시점에 spring에서 구현 객체를 생성해서 DI해줌 private ClubStore clubStore; public ClubServiceLogic(ClubStore clubStore) { this.clubStore = clubStore; // clubStore를 imp..

Spring/spring_old 2023.01.20

05. repository mapstore 구현

초기 구성은 application context를 통해 을 통해 개별적으로 등록하는 방식으로 해보고, 이후에는 과 annotation을 사용함 최종적으로 spring boot를 하면 application context도 필요없음 /resources/applicationcontext.xml DB와 연계해서 데이터를 읽고 쓸 객체를 생성(현재는 Map에 저장함 -> 나중에 DB로 변경) ClubMapStore와 MemberMapStore를 구성(LinkedHashMap에 데이터 저장) 기본적인 DB에 접속해서 CRUD를 구현하는 과정으로 좀더 세부적인 내용은 이후 service logic에서 처리함 ClubMapStore 내용을 갖고 ClubServiceLogic 에서 내용을 구현함 @Repository("..

Spring/spring_old 2023.01.19

04. Data class 등 관련 코딩-01

Data class 패키지 : aggregate 패키지 구성 package spring.study.aggregate; import lombok.Getter; import lombok.Setter; import java.util.UUID; @Getter @Setter public abstract class Entity { // 상속 관계에서 부모로만 작동함 String id; public Entity(){ this.id = UUID.randomUUID().toString(); } public Entity(String id) { this.id = id; } } package spring.study.aggregate.club.vo; import lombok.Getter; import lombok.NoArgsC..

Spring/spring_old 2023.01.19

03. Project 시작 구성-interface 등 구성

프로젝트 패키지(폴더) 구성 Data class 패키지 : aggregate 패키지 구성 ● spring bean으로 관리하지 않는 java data class 집합 ● club, member, membership 관련 class를 생성(uml 참조 변수, 메서드 작성) * modify method를 생성해서 수정에 관련된 내용을 정의 (case 문으로 key를 매칭헤서 이에 맞는 value 값을 찾아 값을 변경하는 방식이나...??? 잘 모르겠음) -> 이를 위해 shared 패키지 생성 /shared/ => NameValue와 NameValueList class 생성(key, value를 위한 리스트를 생성) repository(store) interface 패키지 구성 ● 개별 class(서비스, ..

Spring/spring_old 2023.01.19

Spring 이란?

spring은 자바 기반의(자바를 기반으로 한 다양한 어플리케이션 개발을 좀더 쉽게 하기 위한) 엔터프라이즈 개발을 위한 (소규모 보다는 대규모 프로젝트를 대상) 오픈소스 경량 (간단하게 사용할 수 있는 ??????????) 애플리케이션 프레임워크 (개발을 위한 다양한 어프리케이션 수준의 라이브러리를 제공) 입니다. Spring Project 구성 Spring Framework, MVC, Boot, Data, Cloud, Security 등이 있음 https://spring.io/projects Spring | Projects Spring Framework Provides core support for dependency injection, transaction management, web apps, d..

Spring 2023.01.18

01. Spring Project 개요

스프링 관련 학습내용 유튜브 :Spring 5 for Beginner => https://www.youtube.com/playlist?list=PLOSNUO27qFbsW_JuXmzrFxPw7qzPOFfQs Spring 5 for Beginner 나무소리에서 제작한 Spring 5 기초 강의입니다. Spring 프레임워크의 핵심 내용과 주요 프로젝트(Spring Framework, Spring MVC, Spring Boot, Spring Data JPA)에 대해 학습합니다. www.youtube.com 내용을 들으면서 정리해 가는 것임... 프로젝트는 Travel Club Project 우선 Spring Framework를 통해 화면 구성없이 store, service를 구현하고(Spring boot 없이..

Spring/spring_old 2023.01.18

07./ Spring Web MVC-DB연계-Spring DATA JPA-이름 포함 검색 출력

이전 예제는 이름이 정확히 일치하는 경우이고 이번 예제는 이름을 포함하는 내역을 검색해서 보여주는 예제임 1. interface MemberRepository에 내용 추가 public interface MemberRepository { Member save(Member member) throws ClassNotFoundException; Optional findById(Long id) throws ClassNotFoundException; Optional findByName(String name) throws ClassNotFoundException; List findByNameContaining(String name); List findAll() throws ClassNotFoundException; ..

Spring/spring_old 2023.01.15