Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/property binding for docket configuration #123

Conversation

sam0r040
Copy link
Collaborator

@sam0r040 sam0r040 commented Dec 16, 2022

Springwolf AsyncApiDocket meta data can now be configured without manually creating a bean of AsyncApiDocket. All metadata can by provided with spring application porperties.
Together with #118 (Annotation for publisher and subscriber), it should now be possible to use springwolf without creating a AsyncApiDocket bean at all. Instead annotations and spring application properties can be used.

As a part of the change to use spring properties, a property to disable the producer functionality has been introduced to the kafka and amqp plugins. Although it is a breaking change, we decided to disable the producer functionality by default, because we see the functionality is potentially dangerous for users who are unaware of the feature and want to use springwolf in a production environment.

There is also another property to disable springwolf by spring configuration in springwolf core to support use cases where springwolf should be enabled on some deployment environments, although it should be disabled on others.

sam0r040 and others added 11 commits December 9, 2022 15:56
…ithout the need to write code

Co-authored-by: Timon Back <[email protected]>
…gle the possibility to produce on configured kafka instances

Co-authored-by: Timon Back <[email protected]>
Use prefix in springwolf kafka plugin
Add test for springwolf kafka plugin producer configuration switch

Co-authored-by: Timon Back <[email protected]>
…f wie spring properties

Set AMQP producer functionality to disabled as the new default

Co-authored-by: Timon Back <[email protected]>
…n and SpringWolfConfigProperties

By default, the user-defined AsyncApiDocket is used.
The application.properties are a fall-back, and possible recommended way in the future.
Otherwise, an exception is thrown.

Co-authored-by: sam0r040 <[email protected]>
Bean injection will only work, if the user defined a custom bean
and it does not work, when the application.properties configuration is used.

Co-authored-by: sam0r040 <[email protected]>
Copy link
Member

@stavshamir stavshamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, I really like this improvement.
I have no comments, just one question. I saw that you added annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' to the gradle files - why?

implementation 'org.springframework:spring-web'
implementation 'org.springframework.amqp:spring-rabbit'

implementation 'com.google.guava:guava:31.1-jre'

compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The annotation processor will create metadata files that can be used by IDEs to support code completion when work with spring configuration. This way users are not "blind" when they try to write spring configuration but get contextual help. I'm not sure how many IDEs support it, but Intellij has good support for it. This is what it looks like in Intellij for the sprinwolf-kafka-example project:
image

You can find the documentation here: https://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html#appendix.configuration-metadata.annotation-processor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, I didn't know that

@stavshamir stavshamir merged commit a8169f0 into springwolf:master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants