Hi,
Loaded environment configurations and properties.
Used a Simple Spring Example
Use @Profile annotation if you want to do using code
Use Spring Boot to externalize your environment, load environment related configurations. Environment-specific configuration is usually stored in properties files, YAML files and command line arguments.
In this tutorial, i will show you how to specifically configure your application for the environment it is deployed into.
Having externalized configuration will allow you to propagate your single generated software artifact through your different environments (E.g. Dev, Test, Production).
I first created an application.properties and placed it on the application's CLASSPATH. This is one of four locations Spring Boot will look for the default properties file. Properties configured here will be common for all environments unless explicitly overridden. See Spring Boot Features, 24. Externalized Configuration for properties order.
I then created an application-{environment}.properties file for each environment. The {environment} is substituted for the spring profile. This can be set using -Dspring.profiles.active virtual machine argument. This is passed into the application on bootup so from your deployment YAML file/bash shell script etc.
E.g.
Set your spring profile per environment:
-Dspring.profiles.active=local
-Dspring.profiles.active=dev
-Dspring.profiles.active=test
-Dspring.profiles.active=production
This will then loads the common application.properties THEN the environment specific properties file. One of:
application-local.properties
application-dev.properties
application-test.properties
application-production.properties
Spring will then substitute the properties throughout its configuration of the spring container.
Spring Boot Externalized Configuration - http://docs.spring.io/spring-boot/doc...
Spring Boot Reference Guide - http://docs.spring.io/spring-boot/doc...
---------------------------------------------------------------------------------------------
You can find more front-end development tutorial :- http://www.github.com/sanjay007
SUBSCRIBE TO CHANNEL - / @bangarsanju12
========== Spring Boot Tutorials ==========
• Spring Boot Tutorials For Beginners- ...
============ Spring MVC for Beginners Playlist =============
• Spring MVC Tutorials | Set Up and Fir...
================== Social Links ==================
FaceBook - / frugalisminds
Twitter:- / bangarsanju12
Watch video Load environment configurations and properties with Spring Example | Spring boot @Profile ! online without registration, duration hours minute second in high quality. This video was added by user Code With Sanju 07 January 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 8,021 once and liked it 33 people.