AutoConfigurationModule class
Marks the module of beans a library (a "starter") adds to every application that depends on it.
This is what makes a starter work without any code in the
application: adding the package to pubspec.yaml and rebuilding is
enough. The annotation goes on a public top-level BeanModule variable
in the library's lib/spring_auto_configuration.dart (the file name is
fixed). When an application with @SpringBootApplication() is built,
the generator walks every package it depends on, directly or not,
finds these modules and passes them to the generated
springApplication. They are registered after the application's own
beans.
// lib/spring_auto_configuration.dart of package `neon_cache`
import 'package:spring_boot_dart/spring_boot_dart.dart';
import 'src/cache.spring.dart';
@AutoConfigurationModule(requires: '^0.4.0')
final BeanModule neonCacheAutoConfiguration = $neonCacheBeans;
When starters depend on each other's beans, order, before and
after set the order in which their modules are registered. The
modules are sorted by order, then by name, then before and after
move them; a cycle among those fails the start. A module is named after
its BeanModule (by convention the variable name); an
@AutoConfiguration class inside it can be named too.
requires is the range of spring_boot_dart versions the starter
works with, in pub syntax (^0.4.0, '>=0.4.0 <0.6.0'). The generator
checks it against the version in use and stops the build with an
explanation when they do not match: the job Spring Boot's BOM and
Spring Cloud's compatibility verifier do in Java.
Spring (Java): the META-INF/spring/...AutoConfiguration.imports file
of a starter, plus @AutoConfigureOrder and
@AutoConfiguration(before = ..., after = ...). Spring Boot reads the
file from the class path at startup; here the generator reads it at
build time, so a new starter needs a rebuild.
Constructors
Properties
-
after
→ List<
String> -
Modules, or
@AutoConfigurationclasses by their short name, that must be registered before this one, so its conditions see their beans:['springBootAutoConfiguration']. Unknown names are ignored.final -
before
→ List<
String> -
Modules, or
@AutoConfigurationclasses by their short name, that must be registered after this one, so their conditions see its beans. Unknown names are ignored.final - hashCode → int
-
The hash code for this object.
no setterinherited
- order → int
-
The position among the auto-configuration modules, lower first;
0by default. before and after are applied afterwards. Spring Boot's@AutoConfigureOrder.final - requires → String?
-
The
spring_boot_dartversions this starter works with, as a pub version range;null(the default) accepts any version.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited