Home » Spring

Tag Archives: Spring

Upload files in Spring Boot application using Commons FileUpload

spring-interview-questions-answers

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 »

Uploading files in Spring Boot application

spring-interview-questions-answers

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 »

Introduction into GraalVM (Community Edition): Cloud as a Changing Force

1. Introduction The shift towards cloud computing has had a massive impact on every single aspect of the software development process. In particular, the tools and frameworks the developers have had mastered for years suddenly became unfit, or to say it mildly, outdated. To reflect the reality, the whole new family of frameworks and libraries has emerged, collectively called cloud-native. ...

Read More »

Spring Injection Types

spring-interview-questions-answers

Spring supports three types of dependency injections: Constructor injection @Component public class SecondBeanImpl implements SecondBean { private FirstBean firstBean; @Autowired public SecondBeanImpl(FirstBean firstBean) { this.firstBean = firstBean; } } That is similar to: FirstBean firstBean = new FirstBeanImpl(); SecondBean secondBean = new SecondBeanImpl(firstBean); This type of dependency injection instantiates and initializes the object. In this approach, beans are immutable and ...

Read More »

Content-Security-Policy Nonce with Spring Security

spring-interview-questions-answers

Content-Security-Policy is important for web security. Yet, it’s not mainstream yet, it’s syntax is hard, it’s rather prohibitive and tools rarely have flexible support for it. While Spring Security does have a built-in Content Security Policy (CSP) configuration, it allows you to specify the policy a a string, not build it dynamically. And in some cases you need more than that. ...

Read More »

Jenkins: Automating your delivery pipeline

In this post, we are going to create a Jenkins pipeline for a Java Spring project using Maven and Git: Accessing Jenkins dashboard and configuring Maven in Jenkins: Click on “Manage Jenkins” and then in “Global Tool Configuration” Add a Maven installation and provide a name for it. Click on Save. Creation of our first build job in Jenkins for ...

Read More »

Spring Security

spring-interview-questions-answers

There are many authentication mechanisms (basic, digest, form, X.509, etc), and there are many storage options for credentials and authority information (in-memory, database, LDAP, etc). Authorization depends on authentication and determines if you have the required Authority. The decision process is often based on roles (e.g. ADMIN, MEMBER, GUEST, etc). There are three steps to set up and configure Spring ...

Read More »

Spring MVC REST

spring-interview-questions-answers

Representational state transfer (REST) is an architectural style that describes best practices to expose web services over HTTP, emphasizing performance, scalability, simplicity, modifiability, visibility, portability, and reliability. REST exposes resources through URIs using nouns (not verbs), supporting a limited set of operations (GET, PUT, POST, DELETE). Clients can request particular representations (HTML, XML, JSON, etc) that can link to other ...

Read More »

Spring Web MVC

spring-interview-questions-answers

Spring MVC is a web framework based on the model–view–controller pattern. It is based on the Spring principles and supports a wide range of server-side rendering technologies as JSP, Thymeleaf, Groovy, among others. Dispatcher Servlet It is a front controller that coordinates all the request handling activities. Delegates to the web infrastructure beans and invokes the user’s web components. It ...

Read More »