Default profile in Spring 3.1

前端 未结 7 1105
执笔经年
执笔经年 2020-11-28 19:56

In my application I have beans annotated with @Profile(\"prod\") and @Profile(\"demo\"). The first one, as you can guess :), is used on beans that

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 20:34

    Spring provide two separate properties when determining which profiles are active:

    • spring.profiles.active

    and

    • spring.profiles.default

    If spring.profiles.active is set, then its value determines which profiles are active. But if spring.profiles.active isn't set, then Spring looks to spring.profiles.default.

    If neither spring.profiles.active nor spring.profiles.default is set, then there are no active profiles, and only those beans that aren't defined as being in a profile are created.Any bean that does not specify a profile belongs to default profile.

提交回复
热议问题