Search results for: Java

@ConfigurationProperties annotation is used to bind all the properties in a properties file to a Java class. You can then use an object of the Java class annotated with ConfigurationProperties annotation to access configuration properties defined in a properties file. Earlier I shared with you a tutorial on how to read application properties in Spring Boot RESTful…

Read More Spring Boot @ConfigurationProperties Tutorial

In this tutorial, you will learn how to use Spring Boot Profiles. You can use Spring Boot Profile functionality when providing application configuration for a specific environment. For example, when your application runs in a development environment, then your application will use a specific for that environment application.properties file. And when you are ready to…

Read More Spring Boot Profiles Tutorial

In this tutorial, you will learn how to create a Web Service or a Microservice and how to make it register with Eureka Discovery Server. For a step-by-step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Start Eureka Discovery Server To be able to follow this tutorial, you will…

Read More Register Microservice(Eureka Client) with Eureka Server

Spring Boot has a nice feature that enables the application to automatically restart when you change your Java code. This automatic restart of your application is often called Hot Swap. Spring Boot Dev Tools Dependency To enable your Spring Boot application to automatically restart when you make a change to your Java code, add the…

Read More Spring Boot Hot Swap or Automatic Restart

This tutorial will teach you how to use constructor-based dependency injection(DI) in Spring Framework when building RESTful Web Services. Read the following tutorial to learn about the different types of dependency injection in Spring and which one may be better suited for your specific use case. Constructor-Based Dependency Injection Overview Constructor-based dependency injection is a…

Read More Spring Constructor-Based Injection

In this tutorial, you will learn how to use the @Autowired and @Qualifier annotations to inject a specific instance of a Bean. Sometimes you might have more than one implementation of an interface. If you do not explicitly specify which one you would like to inject, you will get a NoUniqueBeanDefinitionException when starting your application. Let’s…

Read More How to Use @Autowired and @Qualifier in Spring

In this short Spring Boot tutorial, you will learn how to pass command-line arguments to your Spring Boot application. Passing Command-Line Arguments To pass command line arguments to your Spring Boot app when running it with Maven use the -Dspring-boot.run.arguments. In the below code example, I will pass two command-line arguments: firstName and lastName. mvn spring-boot:run…

Read More Pass Command-Line Arguments to Spring Boot Application