parent
072e5e8471
commit
0765a05434
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.springframework.context.annotation;
|
package org.springframework.context.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
@ -44,11 +45,11 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
*
|
*
|
||||||
* <p>If a {@code @Configuration} class is marked with {@code @Profile}, all of the
|
* <p>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
|
* {@code @Bean} methods and {@link Import @Import} annotations associated with that class
|
||||||
* will be bypassed unless one or more the specified profiles are active. This is very
|
* 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
|
* similar to the behavior in Spring XML: if the {@code profile} attribute of the
|
||||||
* {@code beans} element is supplied e.g., {@code <beans profile="p1,p2">}, the
|
* {@code beans} element is supplied e.g., {@code <beans profile="p1,p2">}, the
|
||||||
* {@code beans} element will not be parsed unless profiles 'p1' and/or 'p2' have been
|
* {@code beans} element will not be parsed unless profiles 'p1' and/or 'p2' have been
|
||||||
* activated. Likewise, if a {@code @Component} or {@code @Configuration} class is marked
|
* activated. Likewise, if a {@code @Component} or {@code @Configuration} class is marked
|
||||||
* with {@code @Profile({"p1", "p2"})}, that class will not be registered/processed unless
|
* with {@code @Profile({"p1", "p2"})}, that class will not be registered/processed unless
|
||||||
* profiles 'p1' and/or 'p2' have been activated.
|
* profiles 'p1' and/or 'p2' have been activated.
|
||||||
*
|
*
|
||||||
|
|
@ -73,10 +74,11 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
|
@Documented
|
||||||
public @interface Profile {
|
public @interface Profile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of profiles for which this component should be registered.
|
* The set of profiles for which the annotated component should be registered.
|
||||||
*/
|
*/
|
||||||
String[] value();
|
String[] value();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue