Skip to content

Example code demonstrating usage of Spring profiles

Notifications You must be signed in to change notification settings

mthaler/spring-profiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-profiles

Spring files can be used to restrict creation of beans to specific environments. In this example a ConcurrentMapCacheManager is used for the development environment, whereas EhCacheCacheManage is used for the production environment.

Setting Active Profile

The active profile can be set by passing the spring.profiles.active value as a JVM system property when starting the application:

-Dspring.profiles.active=dev

Alternatively, the profile can be set in application.properties:

spring.profiles.active=prod

Default Profile

To make a profile the default profile, we add "default" to the profile:

 @Profile("prod", "default")

The default profile is used if no spring.profiles.active is set.

Credits

The example code is a Kotlin port of the code from Spring Profiles example

About

Example code demonstrating usage of Spring profiles

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages