Giter Site home page Giter Site logo

KafkaProperties.buildProperties() calls validate before kafkaProducerFactory uses customizers that can still change the validated properties. about spring-boot HOT 6 CLOSED

geertvb avatar geertvb commented on July 21, 2024
KafkaProperties.buildProperties() calls validate before kafkaProducerFactory uses customizers that can still change the validated properties.

from spring-boot.

Comments (6)

wilkinsona avatar wilkinsona commented on July 21, 2024

Thanks for the report but I'm afraid I don't think I understand the problem. How can a DefaultKafkaProducerFactoryCustomizer change the properties that have been bound to KafkaProperties? Are you suggesting that the changes made to the producer's configs by any customizer should be mapped back to KafkaProperties and then the validation should be performed?

from spring-boot.

geertvb avatar geertvb commented on July 21, 2024

The properties used by kafka producer factory is a combination of the properties generated by the buildProperties method and some customizations. The final set of properties should be validated. The properties set produced by buildProperties may not be valid but after the customizations are applied it may and vice versa.
I will provide a minimal example if you prefer.

from spring-boot.

wilkinsona avatar wilkinsona commented on July 21, 2024

The properties set produced by buildProperties may not be valid but after the customizations are applied it may and vice versa.

The intention of the customization is that it allows you to configure things that cannot be configured using the properties. If you're partially configuring something using properties and then completing and correcting it using a customizer, we'd recommend configuring it all using properties or all using a customizer.

I will provide a minimal example if you prefer.

Yes please, it may demonstrate a situation where a split approach is required. If it does, we may want to consider some additional properties to avoid the need.

from spring-boot.

geertvb avatar geertvb commented on July 21, 2024

Regardless of the intention of the customizer, the best moment to validate the state of a constructed bean is when all configuration has been applied. I consider other approaches a workaround and we already have a workaround on our side.
I just wanted to report this conceptual problem.

from spring-boot.

wilkinsona avatar wilkinsona commented on July 21, 2024

Regardless of the intention of the customizer, the best moment to validate the state of a constructed bean is when all configuration has been applied

That's what we're doing. The validation is being applied to KafkaProperties at a time when all properties have been bound to it.

I just wanted to report this conceptual problem.

Thanks. I don't think such a problem exists as there's some separation between the properties and their validation and the customization of a producer factory so I'll close this one.

from spring-boot.

geertvb avatar geertvb commented on July 21, 2024

KafkaProperties is not a (real) bean, just a properties container/helper. Validation should be at the right moment in the kafkaProducerFactory bean its lifecycle (e.g. afterPropertiesSet)

from spring-boot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.