Resilience4j version: 1.2.0
Java version: 1.8
Problem description:
I am trying to explore different patterns provided by resilience4j. I am trying to stick to annotations vs functional programming. But when it comes to resilience4j cahce, I am bit confused, as I couldn't find an working example of the same. I was able successfully try out other patterns.
My confusion is around spring boot cache and resilience4j cache. Are they same or functionally different? Can I use them interchangingly? Is there any github repository giving an usecase and explanation for the resilience4j cache? Any input is highly appreciated.
I got an response from the author Robert Winkler on github, who wrote Resiliance4j-cache component. Below is his resonse.
RobWin:
Hi,
You can stick with Spring Caching Abstraction and Annotations.
Resilience4j-cache is currently not part of the Spring Boot starter and there are no plans to add it.
Resilience4j-cache was created by me when I had to use JCache API and Hazelcast and I wanted to protect my application from runtime exception which were thrown by Hazelcast.
Related
I’m looking for some distributed tracing technologies for our spring boot services, in the internet, I see we have 2 popular choices I.e opentelemetry agent and spring cloud sleuth.
I see both of the them have good integration support, I’m confused to which one to go for, please give me some suggestions
As of today, you can find the following announcement on the Sleuth's Spring page:
Spring Cloud Sleuth’s last minor version is 3.1. You can check the 3.1.x branch for the latest commits. The core of this project got moved to Micrometer Tracing project and the instrumentations will be moved to Micrometer and all respective projects (no longer all instrumentations will be done in a single repository).
Additionally, sleuth is not playing nicely when trying to integrate tracing with other java-but-not-spring-exclusive libraries. To afford any such implementation you would need to configure Sleuth to use the open-telemetry tracer.
Thus, my advice would be to go for open-telemetry, unless you have an exclusive reason not to do that.
As for my current approach, I was introducing otel into an established project that is due for a Spring Boot 3 migration next year. I thus opted to use non-sleuth Spring otel libraries to avoid coupling with Sleuth in this short period.
I am not sure if that's a good approach, but with a lack of proper Spring 2 -> 3 migration, this way will not be a blocker until you can migrate other deps over
We have started new project on spring stack and using latest versions. But we have workflow requirement and I used activiti in past. But as I see there is no spring boot 2 support for activiti and camunda. Can anybody suggest which BPM is best that can be integrated with spring boot 2.
You will find a bunch of Spring Boot 2 starters in the Flowable github repo.
The documentation explains step-by-step how to create a BPM enabled Spring Boot application. There is also the blog post The road to Spring Boot 2.0 that the improved support for Flowable within Spring Boot as part of the Flowable 6.3.0 release.
You ask for suggestions on which BPM is best. Well, I cannot be objective since I am part of the Flowable Team, but I can say that our Spring Boot implementation is pretty neat:
All engines are supported (BPMN, CMMN, DMN), both embedded and exposing their respective REST APIs.
There is an automatic configuration of Spring Security to use the Flowable IDM engine (in case no other custom security is configured).
There is no "EE" version of the starter. Flowable provides Spring Boot 2 support 100% Open Source.
The Spring Actuator integration is quite powerful.
Did I mention Open Source? ;-)
In order to get the all engines you would need to use the flowable-spring-boot-starter(-rest) dependency. The (-rest) needs to be used if you want the Flowable REST APIs to be automatically configured.
There is also the option to run the BPMN, CMMN or DMN engines in standalone mode. For that you would need one of the following dependencies:
flowable-spring-boot-starter-process(-rest)
flowable-spring-boot-starter-cmmn(-rest)
flowable-spring-boot-starter-dmn(-rest)
So, compare for yourself, but for me, it's pretty clear and of course I am open to discussion.
The Activiti is working on Activiti Cloud fully based on Spring Boot 2 and Spring Cloud Finchley (targeting kubernetes deployments, but it can be used outside kubernetes if that is not your thing) if you are looking for a BPMN runtime for Cloud Native applications. We are working hard on releasing the first Beta1 release at the moment, and we will very welcome feedback about it. Hope this helps.
If you use the camunda-bpm-spring-boot-starter you can write self contained services running camunda process engine with spring boot 2.
I have started using spring boot 2.0.0-Snapshot and I see that all Metric related classes and interfaces does not exists ?
Example:
The jar spring-boot-actuator-2.0.0.BUILD-SNAPSHOT.jar does not have package
org.springframework.boot.actuate.metrics.writer at all
Are they moved to somewhere else?
In Spring Boot 2 the previous metrics implementation has been replaced by integration with Micrometer. From the release notes:
Spring Boot’s own metrics have been replaced with support, including auto-configuration, for Micrometer and dimensional metrics. You can learn more about Micrometer in its user manual and Spring Boot’s reference guide
I can't find any guide for migrating from 1.x Spring Boot Metrics to 2.x Spring Boot Metrics but this change is quite recent so I suspect any such docs are a TODO. In the meantime, you could perhaps dig into the Pull Request or follow the Spring Boot 2 docs ...
Micrometer provides a separate module for each supported monitoring system. Depending on one (or more) of these modules is sufficient to get started with Micrometer in your Spring Boot application. To learn more about Micrometer’s capabilities, please refer to its reference documentation.
As part of a new web application project, I'm planning to learn Spring. I started to read through the Spring framework reference. While I was googling, I came across Spring boot. What I understood is that spring boot helps to build application much faster than spring by reducing configuration. Now I'm little confused whether should I continue learning spring or jump to spring boot. My intention is to understand how spring works as a framework rather than a few features. So please let me know, as a beginner what should I do? First, learn Spring and then spring boot or vice-versa.
Update
Ok, I know it's a while since I asked this question. I kind of have an answer (personal one)
I started with Spring Boot and so far built one Spring Boot REST application. Yes, as others said, Spring Boot, helps you to get started quickly and being new to some language/technology, I would love to see a working module ASAP. So Spring boot helps you with that.
Later depending on your interest, you can start exploring in-depth how Spring boot does that magic.
So, in summary, go with Spring Boot and then deep dive to understand the underlying concept. Again this is my opinion.
Thanks, everyone for your inputs/suggestions.
If you want to develop web applications especially micro-services, I will recommend that you should learn Spring Boot first.
The first reason is that there are many resources and examples on
web, so you can easily find what you need.
The second reason is that Spring Framework (including Spring Boot) is
suitable for PaaS environment especially Pivotal. Therefore you can
rapidly deploy your applications without too much effort.
First of all, learn how Spring applications work.
Spring applications are based on the Object Relation Model. You need to understand the annotations and why we use them. Then you have to learn how Spring MVC works. Up to here, both Spring and Spring Boot are similar. Basically, Spring Boot is made so that a Spring-based application can be made very easily. Spring Boot is very good framework for the Web and other.
After learning the above things, then you can jump easily onto Spring Boot. However, if you jump directly to Spring Boot you will see there are many such things which are not described in the Spring Boot tutorials, since many of them expect that you have some prior knowledge of Spring.
Ive been working now with the Spring Framework 3.0.5 and Spring Security 3.0.5 for several time. I know that Spring Framework uses DI and AOP. I also know that Spring Security uses DI, for example when writing custom handlers or filters. Im not sure whether Spring Security also uses AOP - so my first question is: does it?
Well, Id also like to know how Spring Security can be used for non-spring-based applications. Its written in their documentation that this is possible. Well, I wonder how - it seems like it uses DI, so how should it work in a simple java web application? I guess at least a web container which supports dependency injection is needed, correct? (Which one could that be?)
Thank you for answering :-)
[EDIT]
documentation says:
"documentation says: "Spring Security provides comprehensive security services for J2EE-based enterprise software applications. There is a particular emphasis on supporting projects built using The Spring Framework, which is the leading J2EE solution for enterprise software development. If you're not using Spring for developing enterprise applications, we warmly encourage you to take a closer look at it. Some familiarity with Spring - and in particular dependency injection principles - will help you get up to speed with Spring Security more easily.""
j2ee-based enterprise software applications......... emphasis on supporting projects using spring framework...... well this means it should be possible to work with it without Spring Framework itself!
?
AND:
Even though we use Spring to configure Spring Seurity, your application doesn't have to be Spring-based. Many people use Spring Security with web frameworks such as Struts, for example.
This is from the spring security homepage. well....
Does it use AOP ?
Yes spring-security uses AOP for its method security (you'd have to search the page to find it).
Can you use spring-security without spring ?
Generally no.
As you need to define spring beans for several spring-security elements.
But! You can use Acegi security without spring as far as I know. Which should give you close to the same functionality.
Can you secure a non-J2EE application
Definitely.
Anything that can run in a servlet container can be secured with spring-security. You just need Spring's IoC/DI.
This answer can help you on the minimal spring-security dependencies.