일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- jpa
- 인프런
- spring
- QueryDSL
- Android
- 스프링 핵심 기능
- http
- transaction
- 스프링 핵심 원리
- 알고리즘
- AOP
- JPQL
- Greedy
- 김영한
- 그리디
- java
- Servlet
- pointcut
- 스프링
- SpringBoot
- 자바
- JDBC
- Proxy
- Thymeleaf
- db
- Exception
- 백준
- springdatajpa
- kotlin
- Spring Boot
- Today
- Total
목록Spring Boot (25)
개발자되기 프로젝트
스프링 빈을 등록하는 방법은 두 가지가 있다. - 컴포넌트 스캔 & 자동 의존관계 설정 - 자바 코드로 직접 먼저 컴포넌트 스캔에 대하여 알아보자. 1) 컴포넌트(@Component) 스캔과 자동 의존관계 설정 @Controller, @Service, @Repository 등은 모두 @Component 컴포넌트 스캔은 스프링이 시작될 때 @Component붙은 클래스를 bean으로 등록! 스프링은 컨테이너에 빈을 등록할 때 싱글톤으로 등록. 따라서 유일한 인스턴스 존재. @Autowired의 역할을 해당 bean들을 필요한 곳에 연결시키는 역할을 함. 1. @Controller @Controller public class MemberController { } 스프링이 처음 뜰 때 스프링 컨테이너가 생김 ..
실제 서비스와 과련된 로직을 개발해보자. 1. MemberService class 생성 public class MemberService { private final MemberRepository memberRepository= new MemoryMemberRepository(); /** * 회원 가입 */ public Long join(Member member){ //같은 이름이 있는 중복 회원 x validateDuplicateMember(member); memberRepository.save(member); return member.getId(); } private void validateDuplicateMember(Member member) { //컨, 알트, m =method extraction...
1. Member class @Data public class Member { private Long id; private String name; } 2. MemberRepository Interface public interface MemberRepository { Member save(Member member); Optional findById(Long id); Optional findByName(String name); List findAll(); } JPA를 사용하면 위의 코드처럼 선언만 해줘도 사용이 가능하다. 하지만, 지금은 JPA를 사용하지 않기 때문에 해당 method를 사용하기 위해서는 interface에 대한 구현체가 필요하다. 3. MemoryMemberRepository Class ..
실제 개발에 앞서 요구사항 정리가 필요하다. 어떤 데이터를 다룰지, 어떤 기능을 제공할지, DB는 어떤걸 사용할지 등등 앞으로 무작정 코드부터 작성하지 말고 요구사항부터 정리해보자. 1. 데이터 : 회원 id, 이름 2. 기능: 회원등록, 조회 3. DB 미선정 가정 4. 일반적인 웹 애플리케이션 계층 구조 Controller : Web MVC의 controller 역할 Service : 비즈니스 로직 구현 Repository : DB에 접근하고, Domain 객체를 DB에 저장하고 관리하는 역할 Domain : Business Domain 객체, 주로 DB에 저장하고 관리됨. 5. Class 의존관계 추후 DB변경이 가능하도록, interface로 구현 class를 변경할 수 있도록 일단은 가벼운 메모..
1. 정적 컨텐츠 : 파일을 그냥 그대로 내려준다! - 스프링 부트는 정적 컨테츠 지원 Spring Boot Features Graceful shutdown is supported with all four embedded web servers (Jetty, Reactor Netty, Tomcat, and Undertow) and with both reactive and Servlet-based web applications. It occurs as part of closing the application context and is performed in the earliest docs.spring.io 해당 내용을 보면 static하위의 폴더의 html파일로부터 기본적으로 static content를 제..
1. Welcome Page 만들기 recsources/static/index.html 넣어두면 welcome page로 지정됨. Hello hello Welcome page까먹었을 때??? spring.io에 접속해서 Welcome Page에 대한 내용을 직접 찾아볼 수 있다. Spring Boot Features Graceful shutdown is supported with all four embedded web servers (Jetty, Reactor Netty, Tomcat, and Undertow) and with both reactive and Servlet-based web applications. It occurs as part of closing the application conte..
1. Rest Template란? Spring 3.0부터 지원, 간편하게 Rest방식 API를 호출할 수 있는 spring 내장 클래스 2. 사용 방법 1-1) uri 생성 (naverLocalSearchUri에 uri를 String으로 저장해둠) URI uri = UriComponentsBuilder.fromUriString(naverLocalSearchUrl) .queryParams(searchLocalReq.toMultiValueMap()) .build() .encode().toUri(); 1-1) queryParam 만들기 : MultiValueMap 활용 MultiValueMatp는 key & value 형태로 맵핑하여 query param에 사용이 가능하다. add(key, value)를 통해..