Spring Boot @Bean Annotation Example
Java Guides
by
6d ago
 In this tutorial, we will learn everything about Spring Boot @Bean annotation with examples. @Bean Annotation Overview The @Bean annotation indicates that a method produces a bean to be managed by the Spring container.  The @Bean annotation is usually declared in the Configuration class to create Spring Bean definitions. @Bean Annotation Example In order to demonstrate the usage of @Bean annotation, let's create a couple of Java classes. Student and Address class Student{ private Address address; public Student(Address address){ this.address = address; } public ..read more
Visit website
Spring Boot @Component, @Controller, @Repository and @Service
Java Guides
by
1w ago
In this tutorial, we will learn about Spring Stereotype Annotations such as @Component, @Controller,  @Repository, and @Service annotations. Spring Stereotype Annotations Spring Stereotype annotations are used to create Spring beans automatically in the application context (Spring IoC container). The main stereotype annotation is @Component. By using this annotation, Spring provides more Stereotype meta-annotations such as @Service, @Repository, and @Controller. @Service annotation is used to create Spring beans at the Service layer. @Repository is used to create S ..read more
Visit website
Spring Boot Field Injection Example
Java Guides
by
1w ago
In this tutorial, we will learn how to use field-based dependency injection in the Spring boot application. Dependency Injection is a design pattern on which dependency of the object is injected by the framework rather than created by the Object itself - It is also called IOC (Inversion of Control). Dependency Injection reduces coupling between multiple objects as its dynamically injected by the framework. Spring IoC Container uses DI to inject one object into another object.  There are mainly three types of Dependency Injection:  Constructor Injection Setter Injection Field Injecti ..read more
Visit website
Spring Boot Setter Injection Example
Java Guides
by
1w ago
In this tutorial, we will learn how to use setter-based dependency injection in the Spring boot application. Dependency Injection is a design pattern on which dependency of the object is injected by the framework rather than created by the Object itself - It is also called IOC (Inversion of Control). Dependency Injection reduces coupling between multiple objects as its dynamically injected by the framework.  There are mainly three types of Dependency Injection:  Constructor Injection Setter Injection Field Injection In this tutorial, we will see step by step how to use setter-based ..read more
Visit website
Spring Boot Constructor Injection Example
Java Guides
by
1w ago
In this tutorial, we will learn how to use constructor-based dependency injection in the Spring boot application. Dependency Injection is a design pattern on which dependency of the object is injected by the framework rather than created by the Object itself - It is also called IOC (Inversion of Control). Dependency Injection reduces coupling between multiple objects as its dynamically injected by the framework. Spring IoC Container uses DI to inject one object into another object.  There are mainly three types of Dependency Injection:  Constructor Injection Setter Injection Field I ..read more
Visit website
Microservices Quiz - MCQ - Multiple Choice Questions
Java Guides
by
2w ago
This post contains a few useful Microservices (MCQ) multiple-choice questions (quiz) to self-test your knowledge of Microservices and Spring Cloud. Check out Spring Boot Quiz - MCQ - Multiple Choice Questions 1. What are microservices? a) A design pattern used primarily in functional programming and object-oriented programming b) Microservices are used to build monolithic architecture c) Microservices are a software architectural style in which a large application is built as a collection of small, independent, and scalable services d) None of the above Answer: c) Microservices are a softw ..read more
Visit website
Spring Boot Microservices Architecture
Java Guides
by
2w ago
In this tutorial, we will discuss how to create a typical microservices architecture using Spring boot and Spring cloud. Spring Boot is a very popular Java framework for building Restful web services and microservices. The main goal of Spring Boot is to quickly create Spring-based applications without requiring developers to write the same boilerplate configuration again and again. Spring Cloud provides various tools or modules for developers to build common design patterns to solve different infrastructural concerns in Microservices projects and focus on their main business problems. In the ..read more
Visit website
Spring Quiz - MCQ - Multiple Choice Questions
Java Guides
by
2w ago
This post contains a few useful Spring Framework (MCQ) multiple-choice questions (quiz) to self-test your knowledge of the Spring Boot framework. Check out Spring Boot Quiz - MCQ - Multiple Choice Questions The answers to each question have been given at end of this post. 1. What is the main purpose of the Spring Framework?  To provide a comprehensive programming and configuration model for Java-based enterprise applications  To provide a comprehensive programming and configuration model for JavaScript-based web applications  To provide a comprehensive programming and c ..read more
Visit website
Spring Boot Quiz - MCQ - Multiple Choice Questions
Java Guides
by
2w ago
This post contains a few useful Spring Boot (MCQ) multiple-choice questions (quiz) to self-test your knowledge of the Spring Boot framework. The answers to each question have been given at end of this post. Q1. Spring Boot is used for developing? Web applications Distributed applications (Restful web services) Microservices All of the above Q2. What is Spring Initializer? A web-based tool for generating a basic Spring Boot project structure A command-line tool for generating a basic Spring Boot project structure A tool for initializing a Spring-based application with a specific set of dep ..read more
Visit website
Unit Testing Spring WebFlux Controller using JUnit and Mockito
Java Guides
by
3w ago
In this tutorial, we will learn how to unit test Spring WebFlux controller (Reactive CRUD REST APIs) using JUnit and Mockito frameworks. We are going to use @WebFluxTest annotation to unit test the Spring WebFlux controller. @WebFluxTest annotation @WebFluxTest annotation used to test Spring WebFlux controllers.  This annotation creates an application context that contains all the beans necessary for testing a Spring WebFlux controller.  @WebFluxTest is used in combination with @MockBean to provide mock implementations for required collaborators.  @WebFluxTest also auto-configur ..read more
Visit website

Follow Java Guides on Feedspot

Continue with Google
OR