In our previous post, we saw how to upload a file using the Spring framework’s default implementation for MultipartFile interface. In this post, we will see how we can use the Commons FileUpload library and the wrapper implementation CommonsMultipartFile provided by the Spring framework. Update the pom.xml We will update the maven dependencies to include commons-io and commons-fileupload. We will ...
Read More »Home »
Uploading files in Spring Boot application
Uploading files is one of the most common operations in a web application. In this article we will look at how to upload file from an HTML page and copy it to the file system on the server. Creating a HTML form with file upload option The below HTML code and its corresponding Javascript code creates the HTML form and ...
Read More »Validation in Spring Boot applications
Validation in Spring Boot applications can be done in many different ways. Depending on your requirements some ways might fit better to your application than others. In this post we will explore the usual options to validate data in Spring Boot applications. Validation is done by using the Bean Validation API. The reference implementation for the Bean Validation API is ...
Read More »Spring Boot for war
Spring Boot supports the following embedded servlet containers: Tomcat Jetty Undertow You can use Maven, Gradle, or Ant/Ivy as build tools to generate the jar file. However, you may need to use your own server as WebLogic, Wildfly, JBoss, etc. In that case, you would need to generate a WAR file of your Spring Boot project. To do that you ...
Read More »Deploying a Quarkus or any Java based microservice behind an Nginx reverse proxy with SSL using docker
It has been a while but as per a friend requested I am going to show you how to deploy a Quarkus microservice behind an Nginx reverse proxy using docker. What are we going to do… I am going to install docker and docker-compose on a centos 8 host and I am going to deploy a docker container that will ...
Read More »Run method on Spring Boot startup
While developing a spring boot application, sometimes we need to run a method or a piece of code at startup. This code can be anything ranging from, logging certain information to setting up database, cron jobs etc. We cannot just put this code in constructor, because required variables or servies may not be initialized yet. This could lead to null pointers or some ...
Read More »For gourmets and practioners: pick your flavour of the reactive stack with JAX-RS and Apache CXF
When JAX-RS 2.1 specification was released back in 2017, one of its true novelties was the introduction of the reactive API extensions. The industry has acknowledged the importance of the modern programming paradigms and specification essentially mandated the first-class support of the asynchronous and reactive programming for the Client API. But what about the server side? It was not left ...
Read More »Things that make Spring boot Awesome!
For every Java developer Hibernate, Spring are everyday terms. Although recently there was an addition to this list of ‘Spring-boot’. Nowadays Spring Boot is one of the most used open source frameworks. Hence if you are a java developer you must know about spring boot. In this tutorial we will cover srping boot features in detials. Spring-boot can be used ...
Read More »Developing a Simple Service with Spring Boot
In this post, I will demonstrate how to create a simple web service using Spring Boot. This framework makes it almost effortless to develop web services, so long as the appropriate dependencies are in-place. In this example, I will create a web service that will read the current temperature from a file and make it available to clients via a ...
Read More »