Spring Batch Project with Annotation Integrated with Spring Batch Admin - spring-batch

I have a Spring Batch Project which uses annotation based configurations and is a working code by itself. I now want to integrate this with a new Spring Batch Admin project.
I tried some solutions available/answered in the blogs, like adding dependency of batch project to the batch admin project and modifying the META-INF/spring/batch/servlet/override/context-config.xml file to point to the batch project config file.
i.e. . The com.sample.springbatch.job package is present in the Spring Batch project.
However, I am not successful with the integration.
Can anybody point me to or suggest a solution where Spring Batch Project - Annotation Based is integrated with Spring Batch Admin project.
Thank you!
Sonali

I tried this with Batch Admin 2.0.0, you don't want to use #EnableBatchProcessing which is already provided with Spring Batch Admin rather you may use #EnableBatchAdmin. I've added the code in github

Related

Does spring retry dependency covered under spring batch in spring initializr?

Trying to add Retry dependency in spring initializr, but only batch is showed?
Does it mean need to add spring-batch and use retry?
No. Not every possible modules that the Spring ecosystem has is on start.spring.io. We try to reduce things to what's relevant for a getting started experience.
With a project generated on start.spring.io, you already get dependency management for Spring Retry so, if you prefer to use it directly without Spring Batch or another module that uses it, you can add the jar directly. You don't need to specify a version as this is taken care for you.

Spring Annotation-based Project Templates

I am new to Spring. I am learning it from different sources. Spring Recipes, Spring In Action and Spring documentation. According to Spring 3.+, XML configuration can be ignored at all. This is good for me as a beginner.
Problem:
I am using Spring Tool Suite, is there a Spring Web project template that starts with annotations only? All the project templates I have found use XML configuration. I don't even know where to put my DispatcherServlet. I don't know where to put my controllers.
I also had the same problem when Starting out with Spring to find only annotation based templates. Then I found this from John Thompson. This project is completely annotation based and the only xml file involved is pom.xml
I recommend you to run through Spring Guides - they are up to date and use annotation based configuration.
This is guide how to make a restfull web service using spring-boot. It has description how to made project with maven, gradle or STS.
The official recommendation is to base all new projects on Spring Boot which is XML-less out of the box.
STS offers a nice integration with the Spring Initializr service: just go to "New -> Spring Starter Project", fill in a few fields like project name etc. and tick the boxes next to modules you're interested in.

Understanding Spring Boot auto-configuration behavior

Spring Boot docs contain the following phrase:
You can browse the source code of spring-boot-autoconfigure to see the
#Configuration classes that we provide (see the
META-INF/spring.factories file).
How does one browse the specified source, should that be made into a browsable link in the docs?
Appreciate any additional reading materials on how auto-configuration machinery works in Spring Boot. Thanks!

Spring Batch and JiBX: how to debug?

I am testing Spring Batch 2.1.9 on Spring ToolSuite 3.1.0.RELEASE Build Id: 201210061306.
All the depend jars are contained inside the project thro' Gradle/Maven.
I compiled my schema using JiBX on JDK1.6 and run the Spring Batch test program on JDK1.7.
But I got issue with JiBX (1.2.4.5):
The schema jar for my source schema should be correct (i.e. contains the JiBX_binding*" classes) as the job using this jibx-marshaller did complete but only the readcount is zero.
Any hint and recommendation is welcome.
Thanks

Is it possible to use Spring within Eclipse plugins?

Is it possible to use a Spring container for DI from inside Eclipse plugins?
I'm wondering because I know that Eclipse causes a lot of issues with class loading, looking up things within the plugin, etc.
The plugin is intended to be distributed as a JAR.
Yes but you will need Spring DM http://www.springsource.org/osgi
The answer is yes. You can use Spring DM, but you don't have to. It is probably better with it.
I did it without Spring DM and the main concern is class loading issues (not sure if Spring DM solves them, but I guess it should). Assuming you bundle the Spring JAR in a separate plugin with dependencies, you will need to load the context with the class loader of the invoking plugin .
Example:
Plugin A - your functional plugin
Plugin B - The Spring lib plugin exporting the spring packages
Plugin A depends on B. When plugin A starts, it will load the application context, when invoking this load, you will need to do something like:
Thread.currentThread().setContextClassLoader(PluginAActivator.class.getClassLoader())
So that the loading of the classes will happen under your own class loader. Now you can use a ClassPathXmlApplicationContext to load configuration XMLs from your class path.
One small note: the default ClassPathXmlApplicationContext validates your XMLs upon loading. You may want to disable it or point your XMLs to a local schema (rather than the standard Spring schema on springframework.org), otherwise, you will connect to the internet to download the schema files upon loading and working offline will fail.
do you have a code example for your post?
This would be great, since I´m hanging around with this for a while.
Cheers!