6 Working with configuration properties

 

This chapter covers

  • Fine-tuning autoconfigured beans
  • Applying configuration properties to application components
  • Working with Spring profiles

Do you remember when the iPhone first came out? A small slab of metal and glass hardly fit the description of what the world had come to recognize as a phone. And yet, it pioneered the modern smartphone era, changing everything about how we communicate. Although touch phones are in many ways easier and more powerful than their predecessor, the flip phone, when the iPhone was first announced, it was hard to imagine how a device with a single button could be used to place calls.

In some ways, Spring Boot autoconfiguration is like this. Autoconfiguration greatly simplifies Spring application development. But after a decade of setting property values in Spring XML configuration and calling setter methods on bean instances, it’s not immediately apparent how to set properties on beans for which there’s no explicit configuration.

6.1 Fine-tuning autoconfiguration

6.1.1 Understanding Spring’s environment abstraction

6.1.2 Configuring a data source

6.1.3 Configuring the embedded server

6.1.4 Configuring logging

6.1.5 Using special property values

6.2 Creating your own configuration properties

6.2.1 Defining configuration property holders

6.2.2 Declaring configuration property metadata

6.3 Configuring with profiles

6.3.1 Defining profile-specific properties

6.3.2 Activating profiles

6.3.3 Conditionally creating beans with profiles

Summary

sitemap