@java.lang.annotation.Retention(RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({ElementType.TYPE, ElementType.METHOD})
@java.lang.annotation.Documented
@Conditional(OnGrailsEnvCondition.class)
public @interface ConditionalOnGrailsEnv
Registers the annotated bean or configuration only in the named Grails environments.
This is what the beans DSL's .conditionalOnGrailsEnv(...) qualifier compiles to. It exists
because @ConditionalOnProperty(name = "grails.env", ...) - the obvious way to write this -
is only correct when the environment was set explicitly with -Dgrails.env. Grails
otherwise infers the current environment (development when running from a build, production from
a packaged jar) without that property existing anywhere, so the property-based condition silently
never matches and the bean is silently absent. OnGrailsEnvCondition asks Grails.
| Type | Name and Description |
|---|---|
java.lang.String[] |
valueThe environment names to match, as grails.util.Environment reports them - the
built-in ones lowercased (development, production, test,
application), or a custom environment's own name. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |