'Profiles property is deprecated is properties.yml for Spring-Kafka
I'm configuring the application.yml file in my Spring Kafka MS
and I'm getting a notification that the profiles property is deprecated.
This 'profiles' property is deprecated
spring:
profiles:
active: docker
---
The suggested solution is to use this syntax:
spring:
config:
activate:
on-profile: docker
---
But in the log, i can see that 'No active profile set:
I'm using Java 11 with Spring 2.6.2 IDEA: IntelliJ 2022.1 (Ultimate Edition)
: No active profile set, falling back to default profiles: default
Solution 1:[1]
I think you are confusing spring.profiles.active
(which is not deprecated https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.core.spring.profiles.active) with spring.profiles
in a yaml document within the yaml file.
spring:
profiles:
active: dev
---
spring:
config:
activate:
on-profile: dev
kafka:
template:
default-topic: devTopic
...
---
spring:
config:
activate:
on-profile: prod
kafka:
template:
default-topic: prodTopic
...
Vs.
spring:
profiles:
active: local
---
spring:
profiles: dev # deprecated
kafka:
template:
default-topic: devTopic
...
---
spring:
profiles: prod # deprecated
kafka:
template:
default-topic: prodTopic
...
IntelliJ IDEA:
Solution 2:[2]
This is a false-positive deprecation warning. This will be fixed in 2022.1.1 version of IntelliJ IDEA. See https://youtrack.jetbrains.com/issue/IDEA-291799/Spring-Boot:-false-positive-deprecation-mark-in-YAML-for-'spring
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Konstantin Annikov |