πŸ‘¨‍πŸ’» kimtongting
IntelliJ IDEA μœˆλ„μš° 단좕킀 정리
Tab
ν˜„μž¬ μ†ν•œ ꡬ역(κ΄„ν˜Έ) λΉ μ Έλ‚˜κ°

 

F2
였λ₯˜κ°€ λ°œμƒν•œ λΆ€λΆ„μœΌλ‘œ 이동

F2둜 import λ˜μ§€ μ•Šμ€ 곳으둜 μ΄λ™ν•œ λ‹€μŒ λ°”λ‘œ Alt + Enter λˆ„λ₯΄λ©΄ νŽΈν•˜λ‹€.

 

Ctrl + Alt + S
Setting μ°½

 

Ctrl + Alt + Shift + S
Project Structure μ°½

ν”„λ‘œμ νŠΈ JDK 버전 λ³€κ²½ μ‹œ μ‚¬μš©

 

Ctrl + Shift + Enter
; μžλ™ μž…λ ₯

κ΄„ν˜Έ μ•ˆμ—μ„œ μ‚¬μš© μ‹œ ; μžλ™ μž…λ ₯ 및 λ‹€μŒ μ€„λ‘œ Enter λœλ‹€.

μžλ°”μ—μ„œλ„ λ˜μ§€λ§Œ html νŒŒμΌμ—μ„œλ„ κ°€λŠ₯ν•˜κΈ° λ•Œλ¬Έμ— λ‹«λŠ” νƒœκ·Έ 전에 μ»€μ„œκ°€ μžˆμ„ λ•Œ λ‹€μŒ μ€„λ‘œ μ΄λ™ν•˜κΈ° νŽΈλ¦¬ν•˜λ‹€.

 

Alt + insert
μƒμ„±μž, getter(), setter(), toString() λ©”μ„œλ“œ μžλ™ 생성

 

Ctrl + Alt + V
memberRepository.findByName(member.getName());

// Ctrl + Alt + V
Optional<Member> byName = memberRepository.findByName(member.getName());
ν•΄λ‹Ή λ©”μ„œλ“œμ— λŒ€ν•œ λ°˜ν™˜ νƒ€μž…κ³Ό λ³€μˆ˜ μžλ™ μž‘μ„±

 

Shift + F6
λ³€μˆ˜λͺ… 전체 λ³€κ²½

λ³€μˆ˜λͺ… λΆ€λΆ„μ—μ„œ μ‚¬μš© μ‹œ, 같은 λ³€μˆ˜λͺ…을 가진 것 전체 μˆ˜μ • κ°€λŠ₯

Member mem1 = new Member();
mem1.setName("홍길동");

Member mem1 = new Member();
mem1.setName("ν™κΈΈμˆœ");
μœ„ μ˜ˆμ œμ—μ„œ 4번째 쀄 mem1 뢀뢄에 μ»€μ„œλ₯Ό 놓고 Shift + F6을 λˆ„λ₯΄λ©΄ 4, 5번째 쀄 mem1만 μ„ νƒλœλ‹€.

즉 1, 2번째 쀄 mem1은 μ„ νƒλ˜μ§€ μ•ŠλŠ”λ‹€.

 

Ctrl + Alt + T
Surround With

if/else, try/catch λ“±μœΌλ‘œ κ°μŒ€ 수 μžˆλ‹€.

 

Ctrl + Shift + T
Test case μžλ™ μž‘μ„±

class λΆ€λΆ„μ—μ„œ λ™μž‘ν•˜λ©΄ νŒ¨ν‚€μ§€μ™€ ν…ŒμŠ€νŠΈ 클래슀 λͺ¨λ‘ μžλ™ μƒμ„±λœλ‹€.

생성 μ‹œ Create Test μ°½μ—μ„œ λ©”μ„œλ“œ 체크가 μ•ˆ λ˜μ–΄ μžˆλŠ” 경우 λ©”μ„œλ“œ 생성이 λ˜μ§€ μ•ŠμœΌλ‹ˆ 생성할 λ©”μ„œλ“œλŠ” λͺ¨λ‘ 체크해야 ν•œλ‹€.

 

Ctrl + Alt + Shift + T
λ¦¬νŒ©ν† λ§μ— κ΄€λ ¨λœ 것듀을 보여쀀닀.

 

Ctrl + Alt + M
Extract Method μž‘μ„±

memberRepository.findByName(member.getName())
                .ifPresent(m -> {
                    throw new IllegalStateException("이미 μ‘΄μž¬ν•˜λŠ” νšŒμ›μž…λ‹ˆλ‹€.");
                });
                
// Ctrl + Alt + M -> μž…λ ₯ν•œ λ©”μ„œλ“œ λͺ…μœΌλ‘œ λ©”μ„œλ“œ μž‘μ„±λ¨ (ex. validateDuplicateMember)
validateDuplicateMember(member);

private void validateDuplicateMember(Member member) {
    ...
}
 

Ctrl + P
μ»€μ„œκ°€ μœ„μΉ˜ν•œ λ©”μ„œλ“œμ˜ λ§€κ°œλ³€μˆ˜ 쑰회

public class MemberService {
    private final MemberRepository memberRepository;
    
    @Autowired
    public MemberService(MemberRepository memberRepository) {
        this.memberRepository = memberRepository;
    }
}
MemberService의 μƒμ„±μžκ°€ μœ„μ™€ 같을 λ•Œ new MemberService()λ₯Ό ν•˜λ©΄ λ§€κ°œλ³€μˆ˜κ°€ 무쑰건 ν•„μš”ν•  것이닀.

μ΄λ•Œ 였λ₯˜κ°€ λ°œμƒν•˜λŠ”λ°(λΉ¨κ°„ 쀄) ν•΄λ‹Ή 뢀뢄에 μ»€μ„œλ₯Ό 두고 Ctrl + Pλ₯Ό λˆ„λ₯΄λ©΄ μ–΄λ–€ λ§€κ°œλ³€μˆ˜κ°€ ν•„μš”ν•œμ§€ λœ¬λ‹€.

μœ„ κ²½μš°μ—μ„œλŠ” μ•„λž˜μ™€ 같은 λ‚΄μš©μœΌλ‘œ 뜨게 λœλ‹€.

MemberRepository memberRepository
 

Ctrl + E
κ³Όκ±° νžˆμŠ€ν† λ¦¬λ₯Ό λ³Ό 수 있음

ν•΄λ‹Ή μ°½μ—μ„œ λ°”λ‘œ κ²€μƒ‰ν•˜μ—¬ ν•„μš”ν•œ 파일둜 이동 κ°€λŠ₯

 

Ctrl + /
ν•œ 쀄 λ‹¨μœ„ 주석 처리 (ex. //)

 

Ctrl + Shift + /
블둝 λ‹¨μœ„ 주석 처리 (ex. /* */)

 

Shift + F10
이전에 μ‹€ν–‰ν•œ 파일 μž¬μ‹€ν–‰
λ°˜μ‘ν˜•
profile

πŸ‘¨‍πŸ’» kimtongting

@kimtongting μž…λ‹ˆλ‹€

ν¬μŠ€νŒ…μ΄ μ’‹μ•˜λ‹€λ©΄ "μ’‹μ•„μš”β€οΈ" λ˜λŠ” "κ΅¬λ…πŸ‘πŸ»" ν•΄μ£Όμ„Έμš”!