From the course: Spring: Framework in Depth

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Spring Expression Language

Spring Expression Language

From the course: Spring: Framework in Depth

Start my 1-month free trial

Spring Expression Language

- [Narrator] Sometimes declaring multiple Beans to express profiles isn't ideal. In addition, sometimes you want to look different files from the class path based on some value or environment variable. Sometimes you just want to enter complex expressions to define things in your configuration. Enter into the picture Spring Expression Language - SpEL. SpEL gives you the ability to use expressions in your configuration to configure your objects. Let's see a very simple case in action. All right, so let's jump into our Application Config class. And the first thing we're going to do is remove this timeService12 that we just created. And we're going to remove the profile on our Bean for the time service. And we're going to create a new @value annotation. And we'll get to the details here in a minute. private boolean is24. private boolean is24. And now, instead of sending "true" to our time service we're going to set is24.…

Contents