Skip to content

dMitin/spring-def-profile-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

This project describes strange behaviour of Spring Framework Profile (ver 3.1.2.RELEASE).

This project contains two configuration files : ConfigDefault (which is not annotated with @Profile) and Config1 (which is annotated with @Profile("config1")). Every configuration contains bean "example". We will see strange situation, that Spring chooses appropriate configuration depending on configuration class name!

When you run this application, with setting active profile = "config1", Spring chooses ConfigDefault, even if we set active profile!!!! Let's see another trick, let's rename ConfigDefault class name to-> "A". What is result? Now we see that Config1 is choosen.

It's a very strange behaviour. I spent a lot of time, trying to understand, why in test environment my application works in one way, in prod environment - in another)))))

SOLUTION --> just annotate ConfigDefault with @Profile("default").

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published