본문 바로가기

반응형

WINK-(Web & App)/Spring Boot 스터디

(143)
[2025 1학기 스프링부트 스터디] 장민주 #7주차 섹션 10. 빈 스코프- 빈 스코프란?- 프로토타입 스코프- 프로토타입 스코프 - 싱글톤 빈과 함께 사용시 문제점- 프로토타입 스코프 - 싱글톤 빈과 함께 사용시 Provider로 문제 해결- 웹 스코프- request 스코프 예제 만들기- 스코프와 Provider- 스코프와 프록시섹션 10. 빈 스코프 빈 스코프: 빈이 존재할 수 있는 범위 - 싱글톤 스코프: 기본, 스프링 컨테이너의 시작과 종료까지 유지되는 가장 넓은 범위의 스코프- 프로토타입: 스프링 컨테이너는 프로토타입 빈의 생성과 의존관계 주입까지만 관여하고 더는 관리하지 않음, 매우 짧은 범위의 스코프 - 웹 스코프: request, session, application *@Scope("prototype") 과 같이 빈 스코프를 지정할 수..
[2025 1학기 스프링 부트 스터디] 석준환 #7주차 의존 관계 주입 방법 4가지1. 생성자 주입2. 수정자 주입3. 필드 주입4. 메소드 주입 1. 생성자 주입불변, 필수 의존관계에서 사용된다. 즉 바꿀 필요가 없는 의존 관계이고 필수적으로 필요할 때 사용한다.-생성자 호출시점에 딱 1번만 호출된다-불변, 필수 의존 관계에 사용된다@Componentpublic class OrderServiceImpl implements OrderService { private final MemberRepository memberRepository; private final DiscountPolicy discountPolicy; @Autowired public OrderServiceImpl(MemberRepository memberRepository,..
[2025 1학기 스프링 부트 스터디] 남윤찬 #7주차 API 메시지 바디단순 텍스트messageBody에 단순 텍스트를 보내게 되면 content-type이 text/plain으로 설정되어 요청이 넘어온다.protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletInputStream inputStream = request.getInputStream(); String messageBody = StreamUtils.copyToString(inputStream, StandardCharsets.UTF_8); System.out.println("messageBo..
[2025 1학기 스프링 부트 스터디] 여민호 #7주차 [전 강의] 이전 강의에서는 스프링 컨테이너의 생성과 스프링 빈 추가 및 조회,그리고 그 빈끼리의 상속관계에 대해 배웠다.이어서 배울 내용#섹션 5 - 6. BeanFactory와 ApplicationContextBeanFactory와 ApplicationContext에 대해 알아보자먼저 BeanFactory에 대해 알아보자 1. BeanFactory는 스프링 컨테이너의 최상위 인터페이스이다.- 스프링 컨테이너 구조에서 가장 기본이 되는 인터페이스라는 뜻 ( 다른 컨테이너의 기반 ) 2. 다양한 역할을 담당한다.- BeanFactory는 스프링 빈을 관리하는 역할, 조회하는 역할을 한다.(+) getBean( )을 제공한다-> getBean( )은 스프링 컨테이너에 등록된 빈을 꺼내오는 메서드이다. 다음..
[2025 1학기 스프링 부트 스터디] 이상래 #7주차 🔍 AOP👀 AOP가 필요한 상황모든 메소드의 호출 시간을 측정하고 싶다면?공통 관심 사항(cross-cutting concern) vs 핵심 관심 사항(core concern)회원 가입 시간, 회원 조회 시간을 측정하고 싶다면?package hello.hellospring.service;@Transactionalpublic class MemberService {/*** 회원가입*/public Long join(Member member) {long start = System.currentTimeMillis();try {validateDuplicateMember(member); //중복 회원 검증memberRepository.save(member);return member.getId();} final..
[2025 1학기 스프링부트 스터디] 고윤정 #7주차 안녕하세요 7주차 스터디 시작합니당 섹션 8 - AOP AOP가 필요한 상황 MemberService 파일에 아래의 코드를 작성해줍니다 /*** 회원가입*/public Long join(Member member) {long start = System.currentTimeMillis();try {validateDuplicateMember(member); //중복 회원 검증memberRepository.save(member);return member.getId();} finally {long finish = System.currentTimeMillis();long timeMs = finish - start;System.out.println("join " + timeMs + "ms");}}/*** ..
[2025 1학기 스프링부트 스터디] 김민서 #7주차 AOP AOP가 필요한 상황은 언제일까?- 모든 메소드의 호출 시간을 측정하고 싶을 때- 공통 관심 사항 vs 핵심 관심 사항- 회원 가입 시간, 회원 조회 시간을 측정하고 싶을 때 MemberService에서 회원 조회 시간 측정을 추가 해주면package hello.hello_spring.service;import hello.hello_spring.domain.Member;import hello.hello_spring.repository.MemberRepository;import hello.hello_spring.repository.MemoryMemberRepository;import org.springframework.stereotype.Service;import java.util.List;imp..
[2025 1학기 스프링 부트 스터디] 정다은 #7주차 AOP AOP가 필요한 이유1. 모든 메소드의 호출 시간을 측정하고 싶을 때2. 공통 관심 사항 핵심 관심 사항 분3. 회원 가입 시간, 회원 조회 시간을 측정 하고 싶을 때 MemberService 회원 조회 시간 측정 추가package hello.hellospring.service;import org.springframework.transaction.annotation.Transactional;import java.util.List;@Transactionalpublic class MemberService { /** * 회원가입 */ public Long join(Member member) { long start = System.currentTimeMillis();..

반응형