Mongo repository for Spring Batch? - spring

Is there a Mongo-based job repository for Spring Batch? If not, would I need to implement JobInstanceDao and its siblings? Are there any examples or existing works that would help in this endeavor?

there is a https://github.com/jbaruch/springbatch-over-mongodb project, it looks discontinued, but it might give you a better start

I have a github project which enhanced JBaruch's Springbatch-over-mongodb to newer versions of
Spring framework (4+)
Spring-batch (3+)
Mongo DB driver: 2.11.2
https://github.com/vfouzdar/springbatch-mongoDao
Though I have tested it and have a upgraded almost all of junits from JBaruch's project but it is still under BETA phase. If somebody is interested then s/he can give a try.

Related

Is it necessary to use a spring initializr for creating spring applications?

I have started learning about spring and in every tutorial they start from spring initializr, i was wondering is it necessary to use it or we can create a project without using spring initializr ?
No, it is no necessary. You can do everything by your own hands. It just helps you to start quicker so that you focus more on the Spring concepts instead of spending much time on "infrastructure" like configuring dependencies. You run it and it just works. Then you can extend it step by step. This can be especially helpful if you just start learning Spring. Later on you should of course spend some time on other aspects that initializr provides you.
Adding to whatever is already mentioned.
No , it is not necessary to create a project with Spring Initializr
The site provides a curated list of dependencies that you can add to
your application based on the selected Spring Boot version. You can
also choose the language, build system and JVM version for the
project.
https://spring.io/blog/2019/02/20/what-s-new-with-spring-initializr.
https://github.com/spring-io/initializr/
Using Spring Initializr the right dependencies are preconfigured for the Spring Boot version used. These preconfigured projects reduces the setup time and one can start implementing the code rather than investing time on which dependencies to go with.

spring-security-saml2-core upgrade with sprig boot 2

We are trying to upgrade our app to spring boot 2.0 and while doing that we got error java.lang.ClassCastException: org.opensaml.core.xml.schema.impl.XSAnyBuilder cannot be cast to org.opensaml.xml.XMLObjectBuilder. After lot of research, we found that, we are running into trouble because we have two opensaml jars in classpath ( 2 and 3) and decided to upgrade to upgrade spring-security-saml2-core jar to 2.0.0.
We downloaded 2.0.0.SNAPHSHOT jar but it seems there are lot of classes changed/renamed. Is there any documentation/examples where i can compare and migrate my old code easily. For e.g. old jar SamlBootStrap class and new one dont have.
Please help
The differences between the two versions are dramatic, and I understand that also the differences between the opensaml library versions are pretty much so. I made a little project for myself to learn how to use this new versions, and maybe can help you too.
Samlv2App

Spring boot + Activiti explorer

Is it possible to integrate activiti explorer maven plugin with activiti Spring boot app?, so that we can make use of activit-explorer to view deployed process in activit-spring boot engine.
I know we can use rest-api over spring boot to query process engine, but I want to know if it is possible to run the explorer over spring boot by adding it as a maven plugin during deployment?Or can we tweak the activit-explorer.war somehow to point to spring-boot activiti engine?
activiti-explorer.war is standalone webapp by itself. I've write some guideline on how to manually to embed activiti-explorer to you own app. http://blog.canang.com.my/2016/05/12/embedding-activiti-explorer-to-your-application/
Most probably step 5 in my blog is your solution.
btw, there's reason why the name is 'default'. I can't recall it atm
I thought of answering my own question so that it will be useful for other developers with similar requirement. If you want to make an eco-system where activiti-rest, explorer and your custom end points co-exist, please refer this thread from activit forum. I have tried this and is working fine. link to thread
I would like to give my observation here. In order to avoid getting into pulling source and trying to build myself, I achieved partial success, by installing the activit-explorer as part of the usual standalone installation.Started the standalone activiti-explorer using Apache-Tomcat but I configured the database for Activiti as same as (MYSQL in my case) I used in my spring-boot application to hit the common ground.
But apparently the activiti version in my spring boot app was 5.19.0.0 and that for activiti-explorer was 5.22.0.0, which created some misalignment for spring boot application startup to fail. I am hopeful that with matching versions it might succeed. When I get some more time on me I will try and update. Since then may be someone can use this route.

Upgrading to Spring 4

I have a spring 3 app deployed in openshift jboss eap6, and I want to upgrade to ver 4. I also want to upgrade to Java8. Has anyone here been successful in doing so? What are the things that must be considered? How can I make the transition easier? I'm so afraid of Jar hell.
Upgrading von Spring 3.0 to 4.0 could need some changes (depending on what you have done and used). I recommend to do it in small steps, so you can check that everything still works more often, so: uprade to 3.1 first, then 3.2, and then 4.0. After that upgrade to Java 8.
The Spring Reference contain some hints in the what is new section and this Wiki: Migrating from earlier versions of the Spring Framework
Attention: if you upgrade Spring Security too, then I strongly recommend to read its upgrade hints in its Migration documentation!
Solution to your Question
Don't worry Spring 4 is 100% compatible with Java 8
For Jars you need to use the Bill of Materials of Spring 4 Jars which can be obtained in this Link. Use only these jars which will take care of your dependencies issues.
Typically replace all these JAR files in your WEB Applications and try to build and deploy your application. You got your JAR upgrade if it runs without any issues. Most probably 100% it will run without any issues.
Then Depending your scenarios you can apply your spring-framework components.

Spring loaded 1.2.5 + Spring Boot 1.3.2. can't seem to get it to work

I came across a video on youtube ( https://www.youtube.com/watch?v=GTrNkhVnJBU ) where it demos Spring Loaded.
I'm trying to duplicate the same behavior but am still unsuccessful so far.
What I'm using:
Spring Tool Suite 3.7.2
Spring Boot 1.3.2-RELEASE
Spring loaded 1.2.5-RELEASE
Maven version 3.1.0
JDK 1.8.0_71
I tried the same thing as the guy does in the video (except for the versions being more up to date of course) but it doesn't work.
I also tried the "maven plugin" way as described in the spring docs here -> https://docs.spring.io/spring-boot/docs/current/reference/html/howto-hotswapping.html#howto-reload-springloaded-maven
But that also did not work.
I tried changing the versions of spring loaded to 1.2.0 (docs use that version) but that didn't do anything either.
I ran the app in STS itself, and also tried mvn spring-boot:run from command line, but both simply don't get the desired result.
When using mvn spring-boot:run I see that it is attaching the agent:
[INFO] Attaching agents: [C:\Users\ron.m2\repository\org\springframework\springloaded\1.2.5.RELEASE\springloaded-1.2.5.RELEASE.jar]
But changing RequestMappings or method signatures do not get picked up by spring loaded and thus the change is not reflected.
I'm a little out of ideas why I can't get this to work and any help would be greatly appreciated.
Spring loaded does not yet support spring 4.2. See https://github.com/spring-projects/spring-loaded/issues/139
So you either stick with DevTools which definitely speeds up the development process (although not as fast as spring-loaded), use JRebel (which supports the latest spring version) or downgrade to spring 4.1.
As an alternative you could also try the automatic restart feature of Spring Boot Devtools: https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3. It restarts just the app and it is much quicker than restarting the whole JVM. You are loosing application state though, but it might be an alternative.

Resources