|
| 1 | +# DevContainer for Java Spring Boot with GitHub Copilot App Modernization |
| 2 | + |
| 3 | +This DevContainer configuration provides a complete development environment for Java Spring Boot applications with support for GitHub Copilot App Modernization for Java. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### 🐳 Container Base |
| 8 | +- **Base Image**: `mcr.microsoft.com/devcontainers/java:1-21-bullseye` |
| 9 | +- **Docker-in-Docker**: Enabled for containerization workflows |
| 10 | +- **Azure CLI**: Pre-installed for Azure deployment scenarios |
| 11 | +- **GitHub CLI**: For GitHub integration and automation |
| 12 | + |
| 13 | +### ☕ Java Development |
| 14 | +- **Multiple Java Versions**: Java 8, 11, 17, and 21 via SDKMAN |
| 15 | +- **Build Tools**: Maven and Gradle |
| 16 | +- **Spring Boot Support**: Complete Spring Boot development stack |
| 17 | + |
| 18 | +### 🚀 GitHub Copilot Extensions |
| 19 | +- **GitHub Copilot**: AI-powered code completion |
| 20 | +- **GitHub Copilot Chat**: Interactive AI assistance |
| 21 | +- **GitHub Copilot App Modernization for Java**: Specialized tools for Java application modernization |
| 22 | + |
| 23 | +### 🛠️ Development Tools |
| 24 | +- **Java Extension Pack**: Complete Java development experience |
| 25 | +- **Spring Boot Extensions**: Spring Boot dashboard and tools |
| 26 | +- **Testing Framework**: JUnit and testing extensions |
| 27 | +- **Docker Support**: Docker extension for container management |
| 28 | +- **Azure Tools**: Azure development extensions |
| 29 | + |
| 30 | +## Getting Started |
| 31 | + |
| 32 | +### Prerequisites |
| 33 | +- [Visual Studio Code](https://code.visualstudio.com/) |
| 34 | +- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) |
| 35 | +- [Docker Desktop](https://www.docker.com/products/docker-desktop/) |
| 36 | + |
| 37 | +### Usage |
| 38 | + |
| 39 | +1. **Open in DevContainer**: |
| 40 | + - Open the project in VS Code |
| 41 | + - Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) |
| 42 | + - Select "Dev Containers: Reopen in Container" |
| 43 | + - Wait for the container to build and configure |
| 44 | + |
| 45 | +2. **Verify Setup**: |
| 46 | + ```bash |
| 47 | + # Check Java version |
| 48 | + java -version |
| 49 | + |
| 50 | + # Check Maven |
| 51 | + mvn -version |
| 52 | + |
| 53 | + # List available Java versions |
| 54 | + sdk list java |
| 55 | + ``` |
| 56 | + |
| 57 | +3. **Run the Application**: |
| 58 | + ```bash |
| 59 | + # Using Maven wrapper |
| 60 | + ./mvnw spring-boot:run |
| 61 | + |
| 62 | + # Or using Maven directly |
| 63 | + mvn spring-boot:run |
| 64 | + ``` |
| 65 | + |
| 66 | +## Available Ports |
| 67 | + |
| 68 | +- **8080**: Spring Boot Application (auto-forwarded) |
| 69 | +- **3000**: Additional web services |
| 70 | +- **5005**: Java Debug Port (for remote debugging) |
| 71 | + |
| 72 | +## Java Version Management |
| 73 | + |
| 74 | +Switch between Java versions using SDKMAN: |
| 75 | + |
| 76 | +```bash |
| 77 | +# List installed versions |
| 78 | +sdk list java |
| 79 | + |
| 80 | +# Use a specific version for current session |
| 81 | +sdk use java 17.0.12-amzn |
| 82 | + |
| 83 | +# Set default version |
| 84 | +sdk default java 11.0.24-amzn |
| 85 | +``` |
| 86 | + |
| 87 | +## Application Modernization Features |
| 88 | + |
| 89 | +This DevContainer is specifically configured for GitHub Copilot App Modernization for Java: |
| 90 | + |
| 91 | +### Assessment Tools |
| 92 | +- **AppCAT CLI**: Pre-installed for application assessment |
| 93 | +- **Migration Analysis**: Built-in tools for analyzing modernization opportunities |
| 94 | + |
| 95 | +### Modernization Workflows |
| 96 | +1. **Assessment**: Use AppCAT to assess the current application |
| 97 | +2. **Planning**: Leverage Copilot to plan modernization steps |
| 98 | +3. **Implementation**: Use AI-assisted code generation for updates |
| 99 | +4. **Testing**: Comprehensive testing with multiple Java versions |
| 100 | + |
| 101 | +### Example Commands |
| 102 | +```bash |
| 103 | +# Assess application for cloud readiness |
| 104 | +appcat assess --source . --target azure |
| 105 | + |
| 106 | +# Run tests with different Java versions |
| 107 | +sdk use java 8.0.422-amzn && mvn test |
| 108 | +sdk use java 11.0.24-amzn && mvn test |
| 109 | +sdk use java 17.0.12-amzn && mvn test |
| 110 | +``` |
| 111 | + |
| 112 | +## Development Workflow |
| 113 | + |
| 114 | +### Building the Project |
| 115 | +```bash |
| 116 | +# Clean and compile |
| 117 | +mvn clean compile |
| 118 | + |
| 119 | +# Run tests |
| 120 | +mvn test |
| 121 | + |
| 122 | +# Package application |
| 123 | +mvn clean package |
| 124 | + |
| 125 | +# Run with specific profile |
| 126 | +mvn spring-boot:run -Dspring-boot.run.profiles=dev |
| 127 | +``` |
| 128 | + |
| 129 | +### Docker Integration |
| 130 | +```bash |
| 131 | +# Build Docker image |
| 132 | +docker build -t bus-reservation . |
| 133 | + |
| 134 | +# Run with Docker Compose |
| 135 | +docker-compose up -d |
| 136 | +``` |
| 137 | + |
| 138 | +## Troubleshooting |
| 139 | + |
| 140 | +### Java Version Issues |
| 141 | +If you encounter Java version conflicts: |
| 142 | +1. Check current version: `java -version` |
| 143 | +2. Switch to correct version: `sdk use java <version>` |
| 144 | +3. Reload VS Code window if needed |
| 145 | + |
| 146 | +### Extension Issues |
| 147 | +If extensions don't load properly: |
| 148 | +1. Reload the window: `Ctrl+Shift+P` → "Developer: Reload Window" |
| 149 | +2. Rebuild container: `Ctrl+Shift+P` → "Dev Containers: Rebuild Container" |
| 150 | + |
| 151 | +### Port Conflicts |
| 152 | +If ports are already in use: |
| 153 | +1. Check running processes: `netstat -tulpn | grep :8080` |
| 154 | +2. Update port in `application.properties` or use environment variables |
| 155 | + |
| 156 | +## Customization |
| 157 | + |
| 158 | +### Adding Extensions |
| 159 | +Edit `.devcontainer/devcontainer.json` and add extensions to the `extensions` array: |
| 160 | + |
| 161 | +```json |
| 162 | +"extensions": [ |
| 163 | + "your.extension.id" |
| 164 | +] |
| 165 | +``` |
| 166 | + |
| 167 | +### Environment Variables |
| 168 | +Add environment variables in the `containerEnv` section: |
| 169 | + |
| 170 | +```json |
| 171 | +"containerEnv": { |
| 172 | + "CUSTOM_VAR": "value" |
| 173 | +} |
| 174 | +``` |
| 175 | + |
| 176 | +### Additional Tools |
| 177 | +Modify `.devcontainer/post-create.sh` to install additional tools. |
| 178 | + |
| 179 | +## Support |
| 180 | + |
| 181 | +For issues related to: |
| 182 | +- **DevContainer**: Check VS Code Dev Containers documentation |
| 183 | +- **Java Development**: Refer to Java Extension Pack documentation |
| 184 | +- **GitHub Copilot**: Visit GitHub Copilot documentation |
| 185 | +- **App Modernization**: Check GitHub Copilot App Modernization for Java documentation |
0 commit comments