Package io.micronaut.context.annotation
Annotation Type Configuration
-
@Documented @Target(PACKAGE) public @interface ConfigurationA configuration is a grouping of bean definitions under a package. A configuration can have requirements applied to it with
Requiressuch that the entire configuration only loads of the requirements are met. For example consider the followingpackage-info.javafile:@Configuration @Requires(classes = Cluster.class) package io.micronaut.configuration.cassandra; import com.datastax.driver.core.Cluster; import io.micronaut.context.annotation.Configuration; import io.micronaut.context.annotation.Requires;
In the example above the
Requiresannotation ensures all beans contained within the package are loaded only if theClusterclass is present on the classpath.The
ApplicationContextBuilder.include(String...)andApplicationContextBuilder.exclude(String...)methods can also be used to control which configurations are loaded when building theApplicationContext- Since:
- 1.0
- See Also:
Requires,ApplicationContextBuilder.exclude(String...)