diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Profile.java b/spring-context/src/main/java/org/springframework/context/annotation/Profile.java index 03d5d6f4371..36f609798cc 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Profile.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Profile.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,15 +26,16 @@ import org.springframework.core.env.AbstractEnvironment; import org.springframework.core.env.ConfigurableEnvironment; /** - * Indicates that a component is eligible for registration when one or more {@linkplain - * #value specified profiles} are active. + * Indicates that a component is eligible for registration when one or more + * {@linkplain #value specified profiles} are active. * *
A profile is a named logical grouping that may be activated * programmatically via {@link ConfigurableEnvironment#setActiveProfiles} or declaratively - * through setting the {@link AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME - * spring.profiles.active} property, usually through JVM system properties, as an - * environment variable, or for web applications as a Servlet context parameter in - * {@code web.xml}. + * by setting the {@link AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME + * spring.profiles.active} property as a JVM system property, as an + * environment variable, or as a Servlet context parameter in {@code web.xml} + * for web applications. Profiles may also be activated declaratively in + * integration tests via the {@code @ActiveProfiles} annotation. * *
The {@code @Profile} annotation may be used in any of the following ways: *
If a {@code @Configuration} class is marked with {@code @Profile}, all of the
* {@code @Bean} methods and {@link Import @Import} annotations associated with that class
- * will be bypassed unless one or more of the specified profiles are active. This is very
- * similar to the behavior in Spring XML: if the {@code profile} attribute of the
+ * will be bypassed unless one or more of the specified profiles are active. This is
+ * analogous to the behavior in Spring XML: if the {@code profile} attribute of the
* {@code beans} element is supplied e.g., {@code If a given profile is prefixed with the NOT operator ({@code !}), the annotated
- * will be registered if the profile is not active. e.g., for
- * {@code @Profile({"p1", "!p2"})}, registration will occur if profile 'p1' is active or
- * if profile 'p2' is not active.
+ * component will be registered if the profile is not active — for example,
+ * given {@code @Profile({"p1", "!p2"})}, registration will occur if profile 'p1' is active or
+ * if profile 'p2' is not active.
*
- * If the {@code @Profile} annotation is omitted, registration will occur, regardless
+ * If the {@code @Profile} annotation is omitted, registration will occur regardless
* of which (if any) profiles are active.
*
* When defining Spring beans via XML, the {@code "profile"} attribute of the
- * {@code