Punter Vicky
Punter Vicky

Reputation: 16992

Profile annotation without any identifier

I am looking at a project where I see all the classes defined similar to below. I have used Profile annotation to switch between different envs by using something like this - "@Profile(dev)" etc. However what is the purpose of defining Profile annotation without any identifier?

@Profile
@Component

Upvotes: 0

Views: 39

Answers (1)

mrkernelpanic
mrkernelpanic

Reputation: 4451

If you look at @org.springframework.context.annotation.Profile

public @interface Profile {

    /**
     * The set of profiles for which the annotated component should be registered.
     */
    String[] value();

}

You will notice that there is no default value set for the value property. This means the code would not compile and your constellation is wrong. I think that "your" @Profile annotated class is a different annotation than the supposed from Spring.

Upvotes: 1

Related Questions