일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- 백준
- Exception
- 김영한
- 인프런
- Greedy
- 자바
- Android
- http
- 스프링 핵심 기능
- jpa
- 스프링
- transaction
- AOP
- db
- Proxy
- Servlet
- spring
- SpringBoot
- kotlin
- 그리디
- pointcut
- Spring Boot
- JDBC
- Thymeleaf
- 알고리즘
- java
- 스프링 핵심 원리
- QueryDSL
- springdatajpa
- JPQL
- Today
- Total
목록optional (2)
개발자되기 프로젝트
1. 주입할 스프링 빈이 없어도 동작해야 할 경우도 있다. 주입할 스프링 빈이 없어도 동작해야 할 경우도 있다. @Autowired(required = false)로 지정하는 경우, 자동 주입할 대상이 없으면 수정자 메서드 호출 안됨. @Nullable : 자동 주입할 대상이 없으면 null 입력됨. Optional : 자동 주입할 대상이 없으면 Optional.empty가 입력됨. public class AutowiredTest { @Test void AutowiredOption(){ ApplicationContext ac = new AnnotationConfigApplicationContext(TestBean.class); } static class TestBean{ @Autowired(require..
실제 서비스와 과련된 로직을 개발해보자. 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...