If you like to load environment specific spring configuration you can do this using profile. In other words, if you want to load a set of beans that have different settings on different environment (development, testing or production) you can use profile feature instead of pointing to a different spring xml configuration at each stage.
- How to use profile in spring xml configuration?
We have seen in Mybatis + Spring (XML | Annotation) Mapper how to write a simple mybatis-spring app and what is actually needed to get it up and running. Here I will extend that sample code to cover more stuff that you may face in a real “coding”. We will see how to make a single select that will fetch the one and the many of a “one-to-many” relationship, who to use mybatis config file with spring (if you need it), how to test mybatis-spring code using junit and things you need to watch out!
H2 embedded database has been used to make this example easy to run. But you still can use it with other databases e.g. “MySql, Oracle,….”
- How to use make a single select that will fetch all one to many records?
- How to reference mybatis config file in spring xml config file?
- How to test using junit?
jQuery-File-Upload js library is “so far” the most elegant, smart, simple..etc js library I have used to upload files. Simply it is amazing. It supports async upload “Ajax”, multiple files upload, drag&drop, progress update and a lot more. Here we will see an example of uploading multiple files to Spring MVC app. Bootstrap has been used in this example to make the UI more attractive.
Try Simple Demo
Here we will see what we need to do to connect to a relational database “MySql, Oracle, H2..etc” using myBatis with Spring framework & how to implement mappers using xml or annotation such as @Select, @Insert,….etc. For the sake of simplicity I have used H2 embedded database so you can run the sample code. However, you can use this sample code to run with MySql or any other relational database.
Source Code @ github
Note: If you have Maven you can run this sample code directly using
- How to use MyBatis with Spring framework?
- How to implement mapper using xml or annotation @Select, @Insert…?
You can upload files to Spring MVC app in many different ways. For the server side, using MultipartHttpServletRequest is the easiest way to get uploaded files. For the client side we have different options, traditional synchronous method “using html form with submit” or asynchronous method by using Ajax.
Similar Post: Spring MVC + jQuery File Upload (multiple, drag&drop, progress…)
- How to receive uploaded files “Multipart” using Spring MVC?
- How to upload files synchronously “HTML Form and Submit Button”?
- How to upload files asynchronously using JQuyer.ajax or FormData object?
Using Spring MVC we can send the client data in JSON format, but what if the client send POST request with data in JSON format.
Spring MVC + JQuery + @RequestBody + JSON – making it work together
- How client request “GET” data in json format?
- How client send “POST” data in json format using jQuery.ajax()?
- How Spring MVC Controller can map json into java object?
This post is about building a RESTfull client using rest.js which belongs to cujo.js family.
If you want to build SPRING MVC REST application without using rest.js look at these posts
Using POJO as a centric data model for interacting with mongodb, can be achieved with Spring Data.
- Building simple mongodb java application using Spring Data.
In this post we will generate a graph data model and store it in Neo4j db using Spring Data repository.
- How to use Spring Data Neo4j Repository?
This is a simple introduction to Spring Data Neo4j which provides simpler & Spring style development model.
- How to convert POJO to Neo4j entities?
- How to interact with Neo4j db using (Neo4jTemplate)?