Azure-Samples / Azure-Samples/azure-functions-java-flex-consumption-azd

Upgrade Java runtime from 17 to 21 (latest LTS)

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.