Spring Boot Multiple Log Files with Log4j2 or Logback
Learn to create multiple log files in spring boot applications using multiple file appenders. Learn to configure the appenders wiih log4j2 and logback.
Learn to create multiple log files in spring boot applications using multiple file appenders. Learn to configure the appenders wiih log4j2 and logback.
Project lombok can also be used to configure logging in spring boot applications and thus removing the boilerplate code for getting the logger instance.
Logging in spring boot is very easy to configure. Learn to support the logging providers such as commons logback, log4j2 and commons logging in Spring boot.
Learn to create aspectj based interceptor in spring boot application to write performance logging based on time taken in method executions with example.
Learn to configure Ehcahce 3 with Spring Boot 2.x and Spring Boot 3.x applications, use @Cacheable annotation and log caching events.a
Build a Spring Boot 4.1.2 CRUD application with Thymeleaf, Spring Data JPA, validation, H2, and tested create, edit, and delete flows.
Learn to build a robust Spring Boot application with Hibernate, covering CRUD operations, paging, filtering, caching, and best practices.
Configure Hibernate with Spring Boot 4.1.2 and Spring Data JPA. Verify the configured H2 datasource, schema behavior, repository operations and SQL logging.
Configure Spring Boot 4.1.2 embedded Tomcat with tested examples for port, bind address, access logs, HTTPS, and a server customizer.
Learn to configure Spring boot with H2 database to create and use an in-memory database in runtime, generally for unit testing or POC purposes.
Learn to enable and customize the internal and access logs generated for embedded servers in Spring boot e.g. tomcat, jetty & undertow.
Learn to read Spring Boot command-line arguments with ApplicationArguments, validate options, and override configuration properties with a runnable example.
Build OAuth2 authorization and resource servers with Spring Boot 4.1.2. Run client credentials and PKCE flows, validate JWTs, and compare 401 and 403 responses.
Learn to write spring boot async rest controller using SseEmitter which is a specialization of ResponseBodyEmitter for sending Server-Sent Events.
Learn to write spring boot async rest controller using ResponseBodyEmitter to call multiple services and collect the results to the response to the client.
Test asynchronous Spring MVC controllers with MockMvc and MockMvcTester. Run Spring Boot 4.1.2 examples for CompletableFuture, Callable, DeferredResult, and error responses.
Learn to write spring boot async rest controller which support async request processing and returning the response using Callable interface.
Unit test a Spring Boot service with JUnit and Mockito. Mock the repository with @Mock, build the service with @InjectMocks, stub with when().thenReturn() and check calls with verify(). Also covers @MockitoBean in @SpringBootTest, thenThrow, ArgumentCaptor, BDDMockito, strict stubs and the Mockito Java agent on Java 21+.
Test Spring Boot REST controllers with MockMvc and @WebMvcTest. Replace the service with a @MockitoBean mock and send GET, POST, PUT and DELETE requests with JSON. Then check status codes, validation errors and @RestControllerAdvice responses. Also covers MockMvcTester (AssertJ) and real andDo(print()) output on Spring Boot 4.1.1.
Build a Spring Boot 4 multi-module Maven project with a reusable library JAR and executable API. Run the reactor build, focused tests, and HTTP example.
Configure HTTP Basic credentials for Spring RestTemplate with RestTemplateBuilder or per-request headers. A Spring Boot 4 example tests 200 and 401 responses.
Learn to use basic authentication to secure the REST APIs created in a Spring boot application. The secured API will ask for user authentication credentials before giving access to the API response. 1. Maven Dependency The simplest way to add all required jars is to add the latest version of …
Configure RestTemplate connect and read timeouts in Spring Boot 4. A runnable test compares an immediate response with a delayed response and explains the exception.
Send a JSON POST with Spring RestTemplate. Compare postForEntity, postForObject and postForLocation using tested 201, Location, headers and 400 cases.
Learn Spring Boot RestTemplate GET calls with runnable examples for getForObject, getForEntity, custom headers, and missing resources.
Test a Spring Boot POST endpoint with TestRestTemplate on a random port. Verify 201, response body, Location, read-back GET and a 400 error response.
In Spring Boot 3 REST POST API tutorial, create an HTTP POST REST API, return the API response and add validations for the request body.
Retry transient Spring Boot service failures with Framework 7. Test success, exhaustion and permanent errors, and migrate from the older Spring Retry annotations.
Spring boot log4j2 properties configuration example. This enables log4j logging into any spring boot application and start logging into console or file.
Learn to enable and configure caching in a Spring boot application using @EnableCaching, @Cacheable, @CachePut and @CacheEvict annotations.
Replace deprecated Spring RMI and Hessian remoting with a Spring Boot 4 HTTP endpoint and typed client, with tested success and 404 behavior.
Configure RestTemplateBuilder in Spring Boot 4.1.2 with a base URI, headers, timeouts, a global customizer, and a tested replacement builder.
Use a Spring Boot 4.1.2 RestTemplate interceptor to log HTTP request and response metadata, inspect a buffered response body safely, and verify JSON conversion.
Learn to use Spring @Async with @EnableAsync to create non-blocking REST controllers in a Spring Boot application.
Spring boot log4j2.xml configuration example of configuring log4j2 with spring boot2 project and adding logging support to the application.
Configure a Spring Boot 4.1.2 RestTemplate with Apache HttpClient 5, a bounded connection pool, distinct timeouts, and a tested inventory API request.
Set up Spring Boot DevTools, observe a classpath restart after compilation, and distinguish static-resource changes from a packaged JAR run. Verified with Spring Boot 4.1.2.
In Spring boot applications, the default packaging is jar which is deployed in embedded servers. Learn to generate a war file for deployment.
See how @SpringBootApplication enables configuration, component scanning, and conditional auto-configuration in a runnable Spring Boot 4.1.2 example.
In this Spring Boot HATEOAS example, we will learn to add HATEOAS (Hypertext as the Engine of Application State) links to resource representations returned from REST APIs in a Spring boot application. 1. What is HATEOAS? HATEOAS is one of the constraints of the REST architectural style first presented by …
Learn what Spring Boot’s Maven starter parent provides, how its BOM manages versions, and how Gradle or an existing Maven parent changes the setup.
Spring Boot 3 Actuator example to discuss default auto-configuration and monitor and manage our applications in a production-ready manner.
Learn to build spring boot SOAP client in Spring boot applications and consume SOAP web services using WebServiceTemplate and auto client proxy code generation.
In this tutorial, learn to create and consume RSS and Atom feed from spring boot application. You must have seen this in form of text or image buttons on various websites (like our RSS feed) inviting you to “Subscribe via RSS.” RSS is simple syndication API – often referred as …
Configure Spring Boot CORS for controller methods, path groups and Spring Security. Tested examples show allowed origins, preflight, rejected origins and authentication.
In this spring boot soap tutorial, we will focus only in the Spring boot related configurations to see how easily we can create our contract first SOAP webservice.
In this spring boot example, learn to configure web application to run on SSL (HTTPS) with self-signed certificate. Also learn to create SSL cert, as well.
Learn to create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework, and add role based security using JAX-RS annotations e.g. @PermitAll, @RolesAllowed or @DenyAll. Table of Contents Project Structure Create REST APIs Secure REST APIs with JAX-RS Annotations Write security filter using JAX-RS ContainerRequestFilter Demo Project Structure The …
Learn to configure and create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework. This example application uses Jersey’s ServletContainer to deploy the REST APIs.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.