# Setting group.instance.id in a spring boot application

**URL:** <https://forum.confluent.io/t/setting-group-instance-id-in-a-spring-boot-application/37136>\
**Category:** Java Clients\
**Created:** [7 February 2025 07:31 UTC](https://forum.confluent.io/t/setting-group-instance-id-in-a-spring-boot-application/37136 "2025-02-07T07:31:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scot.mcphee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/scot.mcphee/32/4089_2.png) [@scot.mcphee](https://forum.confluent.io/u/scot.mcphee)\
**Post date:** [7 February 2025 07:31 UTC](https://forum.confluent.io/t/setting-group-instance-id-in-a-spring-boot-application/37136/1 "2025-02-07T07:31:21Z")

</div>

Hi,

We have a spring boot application, which runs as multiple `Deployment` pods in a Kubernetes container. This application use Kafka Java Streams to process its data.

I’ve observed that during a deployment of a new version, or if we do a `kubectl rollout restart` on the deployment, that it undergoes several rebalances as instances join and leave the group.

I understand the solution to this to not have dynamically allocated member id’s for the group members, and instead, to use static members configured with `group.instance.id` parameter.

But the question is, given I don’t have a per-instance static configuration (lol, not at all cloud native way of configuring this), _and_ the application is running in a spring boot container, how would I go about _configuring_ this parameter? I can’t just put `group.instance.id: 1` in the spring `application.yaml` – every instance would have the same instance id. At the same time, anything available to me in the spring boot container like hostname or IP address would be unique every single time a container is rotated by the k8s controller.

Does anyone have any recommendations or suggestions?
