Skip to content

Adding Dapr Spring Boot Starter.#457

Closed
darren-wang wants to merge 7 commits into
dapr:masterfrom
darren-wang:dapr-spring-boot-starter
Closed

Adding Dapr Spring Boot Starter.#457
darren-wang wants to merge 7 commits into
dapr:masterfrom
darren-wang:dapr-spring-boot-starter

Conversation

@darren-wang

@darren-wang darren-wang commented Jan 26, 2021

Copy link
Copy Markdown
Contributor

Description

Adding a spring boot starter for dapr to better integrate with Java spring boot applicaitons.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #441

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

*/
@Configuration
@ConditionalOnWebApplication
@ComponentScan("io.dapr.springboot")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the only package to be scanned?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's the package where the Spring beans DaprBeanPostProcessor and DaprController locate, they are the beans provided by dapr to be scanned by spring boot.

Comment thread pom.xml Outdated
<module>sdk-actors</module>
<module>sdk-springboot</module>
<module>examples</module>
<module>dapr-spring-boot-starter</module>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sdk-spring-boot-starter

@artursouza artursouza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please, modify at least one example showcasing how this can be used.

After that we will go into more details on how to get this PR merged, specially if we need to publish a new maven package.

@artursouza

Copy link
Copy Markdown
Contributor

@darren-wang Thanks for your contribution. Please, see comments above. This has potential for the springboot community. It would be great to see an example on how. Maybe change one of our examples in this repo demonstrating that.

…wang/java-sdk into dapr-spring-boot-starter

� Conflicts:
�	sdk-spring-boot-starter/pom.xml
�	sdk-spring-boot-starter/src/main/java/io/dapr/springboot/DaprAutoConfiguration.java
�	sdk-spring-boot-starter/src/main/resources/META-INF/spring.factories
@darren-wang

darren-wang commented Jan 26, 2021

Copy link
Copy Markdown
Contributor Author

@artursouza
I added 2 spring boot micro-services using pubsub, in commit 053b0fe. I added these 2 demos in a separate module since I'm not sure how to integrate them into the original monolith examples.
The 2 demos work differently with current examples, however, it shows how spring boot microservices are built commonly, adding another example module to your project may not be the way you designed, so I just hope it will provide you some thoughts on how to use the starter, and hope you can integrate them to current examples.
Also, the existing artifact dapr-sdk-springboot may be better named with dapr-sdk-spring or so, since it does not provide spring boot features. By saying spring boot we usually mean auto-configuration, simplified k-v properties and so on. Or, we can simply change dapr-sdk-springboot to a boot starter without adding a new starter module, however, it's not the best way to work with traditional non-boot spring applicaitons, since they may not need boot features.

@codecov

codecov Bot commented Jan 26, 2021

Copy link
Copy Markdown

Codecov Report

Merging #457 (ebfa7c8) into master (c5b4cbd) will decrease coverage by 0.14%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #457      +/-   ##
============================================
- Coverage     82.92%   82.77%   -0.15%     
+ Complexity      931      930       -1     
============================================
  Files            79       79              
  Lines          2717     2717              
  Branches        269      269              
============================================
- Hits           2253     2249       -4     
- Misses          331      334       +3     
- Partials        133      134       +1     
Impacted Files Coverage Δ Complexity Δ
sdk/src/main/java/io/dapr/utils/Retry.java 50.00% <0.00%> (-25.00%) 1.00% <0.00%> (-1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5b4cbd...4af271f. Read the comment docs.

@darren-wang

Copy link
Copy Markdown
Contributor Author

Should be replaced by #459

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.

Why not implement java-sdk-springboot as a spring boot starter?

2 participants