- Spring Boot with Gradle
Gradle is a powerful and flexible build automation system that uses a Groovy-based DSL (Domain Specific Language) or Kotlin-based DSL for defining build tasks. It was designed to overcome the shortcomings of Apache Ant and Apache Maven, and it is widely adopted in the Java community, as well as in…
- SpringBoot Interview Questions
What is Spring Boot? – Spring Boot makes it easy to create stand-alone, production-grade Spring-based applications by providing a convention-over-configuration approach. Spring Boot is a powerful framework designed to simplify the bootstrapping and development of Spring applications. Here are some…
- Springboot Retry
Spring framework has a retry project that is very useful when you have a business logic failure that you want to be able to retry to complete. <dependency> <groupId>org.springframework.retry</groupId> <artifactId>spring-retry</artifactId> </dependency> <dependency>…
- Springboot Lombok
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more. Java can get too verbose…
- Spring Boot – OAuth2
Create auth server and resource server Create auth client that consumes resource from a third party like Google or Github
- Spring Boot Thread Pool
One technique would be to balance thread pool size based on individual demand for hardware. However it might be important to give priority to web clients over requests coming in via JMS and therefore you might balance the pools in that direction. Of course as you rebalance you’ll have to adjust the…
- Spring Boot Security Config
Java Security Configuration Add dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> Add SecurityConfig class import org.springframework.beans.factory.annotation.Autowired; import…
- Springboot Rest File Upload
Posting a request of a DTO which has a file in it. Using @RequestPart Frontend Code Source code on Github
- Spring Boot Testing
When it comes to testing, you must follow Test Driven Development principles which have great practices to keep your code and logic clean. One important thing to remember about testing, You must not include logic in your tests. Rules of Test Driven Development Don’t write production code without a…
- Springboot with Thymeleaf
Thymeleaf is a template language that helps serve static files. Add dependencies <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId>…
- Springboot with Swagger
Swagger is an open source project used to generate the REST API documents for RESTful web services. Add swagger and swagger-ui dependencies <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version> </dependency> <dependency>…
- Springboot Mapstruct
A Data Transfer Object(DTO) is an object that is used to encapsulate data or domain model, and send it from one subsystem of an application to another. DTOs are most commonly used by the Services layer in an N-Tier application to transfer data between itself and the UI layer.Mapstruct is by far the…
- Springboot Email
You can use Springboot to send out emails. All you need is access SMTP server. You can then use the JavaMailSender interface to send emails out. Add dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> Add email SMTP…
- Springboot JMS
A production JMS server must be a stand alone server. What we have here is for demonstration purposes. Add dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-activemq</artifactId> </dependency> Add configuration class @Configuration @EnableJms public…
- Springboot Cache
An application without cache is typically slow. Even great code will crawl when handling heavy traffic without cache. Caching can be a fast and relatively cheap way to increase performance. Caching is a performance boost strategy you must implement into your application. Caching is nothing more…
- Spring Boot Code Structure
It is very important to structure your code in a way that is maintainable and easy to work with. A lot of times developers drag their feet to work on a project that is unorganized and hard to follow. Your team members will appreciate the fact that you took the time to organize your code […]
- Spring Security – Authentication
First you need to the spring-boot-starter-security in you pox.xml Configure Spring security using java. This configuration is for APIs. Here we configure our AuthenticationManager, PasswordEncoder, and web security for http routes. Configure your Authentication Provider Configure your Login Filter…
- Spring boot – bean
Spring beans are Java POJO classes created, wired, configured, and managed by the Spring container from start to finish. The Spring container uses DI to manage the components that make up an application. The Spring container gets its instructions on what objects to instantiate, configure, and…
- Spring Boot Rest
- Spring Boot Api Authentication
Spring boot security
- Spring Boot Security @Secured on method level
First, authorities need to be loaded into the Authentication. On the method level use @Secured
- Spring Boot Migration from Spring
- Spring Boot Web MVC
Spring boot makes easy for us developers to get up and running with a spring mvc project. You add the following dependencies and you are ready to go. We are using thymeleaf for our views. Create a controller. Pay attention to the @Controller annotation which turns this class, UserController, into a…
- Spring Boot Hibernate
Hibernate has been used with spring for as long as I can remember. Now that spring boot and spring data have taken the game by storm spring boot with hibernate are no longer relevant. But just in case you are not too familiar with Spring data or you want to keep using hibernate the old […]
- Spring Boot JDBC
Most springboot projects are going with either Hibernate, JPA, or Spring Data. If you are still using JDBC to communicate directly with the database then this tutorial is for you. Step 1 – Add this dependency to your springboot project Step 2 – Add your data source configuration to your…
- Spring Boot AOP
- Spring Boot Events
Spring has events that can help facility functionalities of your application such as sending emails, calling a third party API, or processing an event asynchronously. The design pattern publisher and subscribers is exactly what spring boot events are. First, create a spring event To create a spring…
- Spring Boot Dependency Injection(IoC)
What is IoC or dependency injection? IoC is also known as dependency injection (DI). It is a process whereby objects define their dependencies (that is, the other objects they work with) only through constructor arguments, arguments to a factory method, or properties that are set on the object…
- Spring Boot Introduction
Hello and welcome to my spring boot tutorial. In this tutorial we are going to learn about spring boot and how we can use it to create APIs, web services, and web applications. Spring boot is very easy to set up and to use for development. This tutorial is for you if you are:1. Learning […]
- Spring Boot Elasticsearch
Spring Data has a starter for Elasticsearch that takes away the boilerplate code of configuring Elasticsearch to work with Spring. First create a springboot application. Include this dependency to import Elasticsearch dependencies. <dependency> <groupId>org.springframework.boot</groupId>…
- Code Snippets