Simple Spring batch project in spring source tools suits using maven - spring

I m very new in spring batch project.I m trying to create a project in spring batch framework but i don't know how to create a project in spring batch framework,so please help me regarding my problem.Firstly just tell me that how i create a simple "hello world" program using Simple Spring Batch Project in spring source tools suits using maven.
Thanks in advance.

From the documentation, it looks like there is no real maven archetypes to build the skeleton of a spring batch projet.
The documentation recommends anyway to copy samples and examples from their website to start from.
http://static.springsource.org/spring-batch/getting-started.html

Spring Batch is not trivial for the first time, then I recommend you to copy this code:
https://github.com/spring-projects/spring-batch/tree/master/spring-batch-samples
Then, using Eclipse open this (Maven project) and compile (mvn clean install)
Last thing (if all works ok) just run the main method, usually o Scheduler task.

Related

How to build an Angular2 type script with spring boot back end in STS

I am learning angular 2 currently and trying to hosted in springboot java application.
I created a separate project using angular cli , then I created spring starter project with web only.
Next I imported the angular cli project inside /src/main/resources/static directory.
when I opened the browser , I was not able to see the basic index.html.
Then I removed all the imported files and imported only the content of the directory , which is the resulting compiled ES5 java script after transpiling the type script files in directory, this time it worked.
My questions are:-
1) What is the best practice , to use the GUI under /src/main/statis or create /src/main/public or /src/main/webapp ?
2) Does spring understand only js and not ts ( java script and not type script)?
3) Do I need a maven plugin for typescript and if so how to tell maven bundle the compiled js with the spring war while excluding the rest directories and files
4) How to include the testing unit / e2e with maven build
I searched for step by step guide for ANgular 2 and spring boot but could not find one. It would be helpful to many if some guide like this exist.
Many thanks for your support guys.
1) What is the best practice , to use the GUI under /src/main/statis or create /src/main/public or /src/main/webapp ?
Since typescript compiles to JavaScript I strongly recommend using GULP. I have my source files under src/client and I build with gulp to add the files to src/main/public
I believe either public or webapp works and there's not a huge difference.
2) Does spring understand only js and not ts ( java script and not type script)?
The newer version of STS has support for typescript, but I prefer to use visual studio code when viewing typescript files as there is better support.
3) Do I need a maven plugin for typescript and if so how to tell maven bundle the compiled js with the spring war while excluding the rest directories and files
If you use gulp, the typescript is compiled to js and added to the src/main/public directory where your springboot app sees the files when running with maven.
4) How to include the testing unit / e2e with maven build
I searched for step by step guide for ANgular 2 and spring boot but could not find one. It would be helpful to many if some guide like this exist.
Many thanks for your support guys.
I recommend using an angular seed or starter, this seems like the most up to date one that I've found:
https://github.com/antonybudianto/angular2-starter
This uses gradle, but is spring boot and angular 2:
https://github.com/borysn/spring-boot-angular2
I shared a project on github that integrates Angular 2 With spring boot. Just need to follow the step on readme or check commit history. You can access here Angular 2 with spring boot

Spring Roo web mvc setup generates error globalsearch.java class doesn't exists or has been deleted

I am quite new to Spring, now trying out Roo. I am following documentation from http://docs.spring.io/spring-roo/docs/2.0.0.M1/reference/html/
I was able to create the entity classes and fields, perform tests as well. Now when I run
roo> web mvc setup
it creates a few files in \config, \validatin, \html\converter but then produces undo create ... for the same files & folders. At the end it says
ERROR: GlobalSearch.java class doesn't exists or has been deleted.
I am running Windows 10 64 bit, STS 3.8 Release, Roo 2.0.0.M2, Maven 3.3.9, Jdk 1.8
Googling this as well as searching in StackOverflow gave just one slightly relevant result without resolution Spring Roo: 'web mvc setup' fails with 'display name required'.
In fact I have been facing many issues, each step of the way and googling my way through, so it has been a very painful experience so far, so any help is greatly appreciated.
I was using a separately downloaded roo (v 2)for this.
Alternatively I used STS and added roo (v 1.3.1RC1) extension thru Help>Dashboard and opened roo console in STS (Window>Show view>Roo shell), was able to run the commands for mvc web setup and mvc web all --package ~.web and generate required files!
But don't know why the separate roo console wouldn't work.
Thanks for all who viewed and tried to help.
First you need to create DAO layer:
repository jpa --all --package ~.repository
This will generate GlobalSearch.java in repository package.

How to combine 3 standalone applications on java and run parallely with maven in spring

How to combine 3 standalone applications on java and run parallely with maven in spring.
The three othe standalone applications run on different Db's and I want to make use of these three in my main Standalone app.
What are the required maven settings i need to follow and what are the best spring components i used.
Any kind of answer is appresiable.
Thanks in Advance.
About Maven.
I recomend you to use a Repository Manager (Nexus, Artifactory...). In that repository, you can upload manually your aplications as a jar (I assumed that these three app are not build with Maven, but it could be interesant to migrate them, you should evaluate that).
You have to configure your new app pom.xml and settings.xml to get access to this repository. And then, you can add these dependencies in your new app pom.xml. After that, you can use your applications classes in your new app.
About Spring
Spring Framework, has a lot of things that could help you in your development (like dependency injection, jdbcTemplate and a large etc)
I really recommend you to read the documentation (with the index you can get an idea), and evaluate what things could help you.

Spring Batch using eclipse or STS

I am new to Spring Batch. I want to understand by making some simple Hello World or by reading a CSV file. On internet I saw many examples but everyone is explaining the code but nobody is talking about project structure or how to create project in eclipse or STS. Please provide me links which can explain the process very simple or share the articles for it.
You can download and import a simple Spring Batch project directly from STS:
Click: File -> New -> Spring Project
In the "New Spring Project" Window, under "Templates", expand the "Batch" folder.
Click on "Simple Spring Batch Project", provide aproject name and click the "Next" button.
That's it. The project has what I would call a simple spring and spring-batch standard setup. You can easily extend it by adding an ORM-framework or whatever you like ...
There is a guide providing exactly what you are looking for (how to structure the project, Maven/Gradle config, code, etc) on the spring.io web site:
http://spring.io/guides/gs/batch-processing/
It's generally a good idea to follow the tutorials on spring.io before following tutorials from anyone else.

How to run a project containg drools in Tomcat7?

I have created a Dynamic web project which also uses drools for providing some functionality. When i put the WAR file in Tomcat7 and the server, the drools part does not work.
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
After this line which is first line relating to drools, nothing happens.
Is some configuration required to run my project containing drools 5.5.0 Final in the Tomcat7.
Please help me. I am badly stuck and I am new to drools.
You'll have to add some facts to the working memory and execute(fire) the rules. Check out these examples on GitHub
P.S. Probably not related to Tomcat in any way. Might be worth while to try getting the rules executed from command line app first.
You need to check all the dependencies that are added to your web application (WEB-INF/lib) make sure that drools has all the required deps there, because if not it will not be able to create the knowledge builder. Most of the time if it is failing is because that you forgot to add the deps in the web app.
The following project in GitHub is a web application, containing some REST-style endpoints for validating IBANs. It uses Drools 5.5 to perform that evaluation.
https://github.com/gratiartis/sctrcd-payment-validation-web/
It generates a .war which can be loaded into Tomcat, and could be a useful starting point. The knowledge base is wrapped within a Spring service:
https://github.com/gratiartis/sctrcd-payment-validation-web/blob/master/src/main/java/com/sctrcd/payments/validation/RuleBasedIbanValidator.java
Following through how that creates a knowledge base and session might help you see where your code is going wrong.
As a bonus, you can run it up in Tomcat using "mvn tomcat7:run" to test it out immediately.

Resources