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.

Profiles

Profiles

From the course: Spring: Framework in Depth

Start my 1-month free trial

Profiles

- [Narrator] We talked about using environment variables for flexing by environment. Sometimes, however, there's a desire to change behavior based on preconfigured profiles. A case for this that I have used are injecting mocking behavior in a QA environment. So let's take a look at this in action in Spring. Back in our IDE, I want you to open your config file. And we're going to take our time service here, and we're going to add to it an app profile beam. And we're going to say notdev. Now we're going to create a duplicate instance of this beam. Well, sort of duplicate. So app beam, app profile, and this time we're going to say dev. And now we're going to do a public time service, and since this is JAVA, we have to give it something else, so we'll call it timeservice12. And we're going to return a new time service, but this time we're going to set our 24-hour equal defaults. So, when we're in dev, we…

Contents