# πŸš€ Spring Legacy (Non-Boot) ν•«μŠ€μ™‘ ν™˜κ²½ ꡬ좕 κ°€μ΄λ“œ λ³Έ κ°€μ΄λ“œλŠ” 폐쇄망(Air-gapped) ν™˜κ²½μ—μ„œ **JRebel** λŒ€μ•ˆμœΌλ‘œ \*\*JetBrains Runtime(JBR)\*\*κ³Ό **HotswapAgent**λ₯Ό μ‚¬μš©ν•˜μ—¬, μ„œλ²„ μž¬μ‹œμž‘ 없이 Java μ½”λ“œλ₯Ό μ¦‰μ‹œ λ°˜μ˜ν•˜λŠ” 방법을 μ„€λͺ…ν•©λ‹ˆλ‹€. ## 1\. 외뢀망 μ€€λΉ„λ¬Ό (λ°˜μž… 리슀트) νμ‡„λ§μœΌλ‘œ λ°˜μž…ν•΄μ•Ό ν•  ν•„μˆ˜ νŒŒμΌμž…λ‹ˆλ‹€. | ν•­λͺ© | μš©λ„ | λ‹€μš΄λ‘œλ“œ 링크 (μ˜ˆμ‹œ) | | :--- | :--- | :--- | | **JBR (JetBrains Runtime)** | DCEVM이 λ‚΄μž₯된 JDK | [JBR GitHub Releases](https://github.com/JetBrains/JetBrainsRuntime/releases) | | **HotswapAgent.jar** | Spring Bean μ„€μ • κ°±μ‹ μš© | [HotswapAgent Releases](https://github.com/HotswapProjects/HotswapAgent/releases) | > **주의**: JBR 버전은 ν”„λ‘œμ νŠΈμ˜ Java 버전(8, 11, 17 λ“±)κ³Ό μΌμΉ˜μ‹œμΌœ λ‹€μš΄λ‘œλ“œν•˜μ„Έμš”. ----- ## 2\. IDE(IntelliJ / Eclipse) ν™˜κ²½ μ„€μ • ### 2.1 JDK(JBR) 등둝 1. λ°˜μž…ν•œ JBR 압좕을 ν’‰λ‹ˆλ‹€ (예: `C:\dev\jbr`). 2. **IntelliJ**: `Project Structure` \> `SDKs` \> `Add JDK` ν›„ ν•΄λ‹Ή 경둜 μ§€μ •. 3. **Eclipse**: `Preferences` \> `Java` \> `Installed JREs` \> `Add` ν›„ ν•΄λ‹Ή 경둜 μ§€μ •. ### 2.2 VM μ˜΅μ…˜ μΆ”κ°€ μ„œλ²„(Tomcat λ“±)의 μ‹€ν–‰ ꡬ성(Run/Debug Configuration)에 μ•„λž˜μ˜ **VM Options**λ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€. ```bash # 클래슀 ꡬ쑰 λ³€κ²½(ν•„λ“œ/λ©”μ„œλ“œ μΆ”κ°€) ν—ˆμš© -XX:+AllowEnhancedClassRedefinition # Spring Bean μ„€μ • 및 λ¦¬μ†ŒμŠ€ μ‹€μ‹œκ°„ 반영 (경둜 주의) -javaagent:C:\path\to\hotswap-agent.jar -XX:HotswapAgent=fatjar -Dhotswap.agent.disablePlugin=org.hotswap.agent.plugin.ibatis.IBatisPlugin,org.hotswap.agent.plugin.mybatis.MyBatisPlugin ``` ----- ## 3\. IDE별 μ„ΈλΆ€ μ΅œμ ν™” μ„€μ • ### IntelliJ IDEA 1. **컴파일러 μ„€μ •**: - `Settings` \> `Build, Execution, Deployment` \> `Compiler` - **Build project automatically** 체크 2. **κ³ κΈ‰ μ„€μ •**: - `Settings` \> `Advanced Settings` - **Allow auto-make to start even if developed application is currently running** 체크 3. **μ—…λ°μ΄νŠΈ μ •μ±…**: - Tomcat μ„€μ • λ‚΄ `On 'Update' action` 및 `On frame deactivation`을 **Update classes and resources**둜 λ³€κ²½. ### Eclipse 1. **Auto Build**: `Project` \> `Build Automatically` 체크 확인. 2. **Debug λͺ¨λ“œ**: λ°˜λ“œμ‹œ **Debug** λͺ¨λ“œλ‘œ μ„œλ²„λ₯Ό μ‹€ν–‰ν•΄μ•Ό ν•«μŠ€μ™‘μ΄ μž‘λ™ν•©λ‹ˆλ‹€. ----- ## 4\. μ‹€μ œ 개발 μ›Œν¬ν”Œλ‘œμš° 1. **μ„œλ²„ μ‹€ν–‰**: λ°˜λ“œμ‹œ **Debug λͺ¨λ“œ**둜 μ‹€ν–‰ν•©λ‹ˆλ‹€. 2. **μ½”λ“œ μˆ˜μ •**: λ©”μ„œλ“œ 둜직, ν•„λ“œ μΆ”κ°€, μƒˆλ‘œμš΄ `@Service` 생성 등을 μˆ˜ν–‰ν•©λ‹ˆλ‹€. 3. **반영 (Compile)**: - **IntelliJ**: `Ctrl + Shift + F9` (ν˜„μž¬ 파일 재컴파일) λ˜λŠ” `Ctrl + F9` (전체 λΉŒλ“œ). - **Eclipse**: μ €μž₯(`Ctrl + S`) μ‹œ μžλ™ 컴파일 및 반영. 4. **확인**: μ„œλ²„ μž¬μ‹œμž‘ 없이 λΈŒλΌμš°μ €μ—μ„œ μƒˆλ‘œκ³ μΉ¨ν•˜μ—¬ κ²°κ³Όλ₯Ό ν™•μΈν•©λ‹ˆλ‹€. ----- ## 5\. μ£Όμš” μ£Όμ˜μ‚¬ν•­ (Troubleshooting) * **상속 ꡬ쑰 λ³€κ²½**: 클래슀의 λΆ€λͺ¨λ₯Ό λ°”κΎΈκ±°λ‚˜ μΈν„°νŽ˜μ΄μŠ€λ₯Ό λ³€κ²½ν•˜λŠ” μˆ˜μ€€μ˜ 큰 μˆ˜μ •μ€ μ„œλ²„ μž¬μ‹œμž‘μ΄ ν•„μš”ν•  수 μžˆμŠ΅λ‹ˆλ‹€. * **정적 λ³€μˆ˜(Static)**: `static` ν•„λ“œμ˜ μ΄ˆκΈ°κ°’ 변경은 ν•«μŠ€μ™‘ 후에도 이전 값이 μœ μ§€λ  수 μžˆμŠ΅λ‹ˆλ‹€. * **폐쇄망 라이브러리**: `hotswap-agent.jar` 외에 νŠΉμ • ν”„λ ˆμž„μ›Œν¬(예: MyBatis, Hibernate) μ „μš© ν”ŒλŸ¬κ·ΈμΈμ΄ ν•„μš”ν•œ 경우, HotswapAgent μ„€μ • 파일(`hotswap-agent.properties`)을 톡해 μ œμ–΄ν•  수 μžˆμŠ΅λ‹ˆλ‹€.