Azure-Samples / Azure-Samples/azure-functions-java-flex-consumption-azd
Upgrade Java runtime from 17 to 21 (latest LTS)
- Dominant language
- Bicep
- Stars
- 6
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Upgrade the Java runtime from 17 to 21, which is the latest LTS version supported by Azure Functions.
## Current State
**infra/main.bicep:**
```bicep
runtimeName: 'java'
runtimeVersion: '17'
```
**http/pom.xml:**
```xml
17
...
17
```
## Proposed Changes
**infra/main.bicep:**
```bicep
runtimeName: 'java'
runtimeVersion: '21' // Latest LTS
```
**http/pom.xml:**
```xml
21
...
21
```
## Why This Change?
Java 21 is the latest LTS (Long Term Support) version with:
- Virtual Threads (Project Loom) - improved concurrency
- Pattern Matching for switch
- Record Patterns
- Better performance and GC improvements
## Supported Java Versions (Feb 2026)
| Version | Status |
|---------|--------|
| 21 | ✅ LTS (recommended) |
| 17 | ✅ LTS |
| 11 | ✅ LTS |
| 8 | ✅ LTS |
## Testing Checklist
- [ ] `mvn clean package` succeeds
- [ ] `func start` runs without errors
- [ ] `azd up` deploys successfully
- [ ] HTTP functions respond correctly
- [ ] No deprecation warnings in logs
## Reference
- [Azure Functions Java Support](https://learn.microsoft.com/azure/azure-functions/supported-languages#languages-by-runtime-version)
Contributor guide
Assessment
This issue has not been assessed yet.