본문 바로가기

전체 글

(13)
[Vue] 기초 다지기 웹 페이지 풀스택 개발을 맡게되었다.Flutter는 보통 앱 개발에 많이 사용한다고 하고, React는 단시간에 배우기 어렵다고 해서 이미 알고 있는 HTML, CSS, Javascript를 활용할 수 있는  Vue로 정했다.  Visual Studio Code에 Vue3를 설치하여 환경을 구축한다. npm: 각종 웹 개발 라이브러리 설치 도우미 App.vue가 main 코드, index.html이 메인 화면이다.App.vue의 코드를 html로 컴파일하여 화면으로 나타나게 된다. 아래에는 html을 짜고, 아래에는 javascript를, 아래에는 css로 작업하면 된다. 패키지들을 소개한다.node_modules: 프로젝트에 쓰는 라이브러리들src: 소스코드를 담아두는 곳public: html 파일..
[스프링 입문] 용어 정리 스프링의 기반IoC(Investion of Control): 제어의 역전public class A { //코드에서 객체를 생성하지 않고 어디선가 받아온 객체를 b에 할당 private B b;} 다른 객체를 직접 생성하거나 제어하는 것이 아니라 외부에서 관리하는 객체를 가져와 사용한다. DI(Dependency Injection): 의존성 주입제어의 역전을 구현하기 위해 사용하는 방법으로, 어떤 클래스가 다른 클래스에 의존하는 것.public class A { //A에서 B를 주입받았을 뿐 직접 객체 생성하지 X @Autowired B b;} @Autowired: 상황에 맞는 컨테이너 안에 존재하는 빈을 자동으로 주입시켜준다. 즉, 다른 곳에 있는 클래스를 편하게 끌어다 쓸 수 있는 기능..
[스프링 입문] 회원 웹 기능 - 홈 화면 추가, 등록, 조회 controller 아래에 HomeController 클래스를 생성한다.package hello.hello_spring.controller;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;@Controllerpublic class HomeController { @GetMapping("/") public String home() { return "home"; }} template 아래에 home.html을 생성한다.  Hello Spring 회원 기능 회원 가입 ..
[스프링 입문] 자바 코드로 직접 스프링 빈 등록하기 앞선 실습에서 붙인 @Service와 @Repository를 삭제하고 자바 코드로 스프링 빈을 등록한다. service 아래에 ServiceConfig 클래스 생성 *ServiceConfigpackage hello.hello_spring.service;import hello.hello_spring.repository.MemberRepository;import hello.hello_spring.repository.MemoryMemberRepository;import hello.hello_spring.service.MemberService;import org.springframework.context.annotation.Bean;import org.springframework.context.annotatio..
[스프링 입문] 컴포넌트 스캔과 자동 의존관계 설정 controller 아래에 MemberController 클래스 생성 *MemberControllerpackage hello.hello_spring.controller;import hello.hello_spring.service.MemberService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;@Controllerpublic class MemberController { private final MemberService memberService; @Autowired public MemberController(MemberService m..
[스프링 입문] 회원 서비스 개발, 테스트 service 패키지에 MemberService 클래스 생성 *MemberServicepackage hello.hello_spring.service;import hello.hello_spring.domain.Member;import hello.hello_spring.repository.MemberRepository;import hello.hello_spring.repository.MemoryMemberRepository;import java.util.List;import java.util.Optional;public class MemberService { private final MemberRepository memberRepository; public MemberService(MemberRe..
[스프링 입문] 회원 리포지토리 테스트 케이스 작성 test 아래에 repository 패키지 만들고 테스트하고자 하는 클래스 이름+Test으로 클래스 생성 후 테스트 케이스 작성package hello.hello_spring.repository;import hello.hello_spring.domain.Member;import org.junit.jupiter.api.AfterEach;import org.junit.jupiter.api.Assertions;import org.junit.jupiter.api.Test;import java.util.List;import static org.assertj.core.api.Assertions.assertThat;class MemoryMemberRepositoryTest { MemoryMemberReposit..
[스프링 입문] 회원 도메인과 리포지토리 만들기 *Member Classpackage hello.hello_spring.domain;public class Member { private Long id; private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; }} *MemberRepository Interfacepackage hello.hello_spring.re..