SpringBootApplication class

Marks the main function of an application, so that the generator writes everything needed to start it.

This is the one annotation every application has. When dart run build_runner build sees it, spring_core_dart_generator scans the whole package (lib/ and the directory of main) for beans and writes main.spring.dart next to main. That file holds the bean definitions, the files of lib/resources/, the auto-configuration of every dependency that is a starter, and the functions that start the application: runApplication(args), runApplicationAsync(args) (which waits for the runners and reads Flutter assets), and the hot reload helpers. No @ComponentScan and no list of modules is needed.

// bin/main.dart (lib/main.dart in Flutter)
import 'package:spring_boot_dart/spring_boot_dart.dart';

import 'main.spring.dart'; // generated

@SpringBootApplication()
void main(List<String> args) => runApplication(args);

Spring (Java):

@SpringBootApplication
public class App {
  public static void main(String[] args) {
    SpringApplication.run(App.class, args);
  }
}

exclude and excludeName switch off auto-configuration that a starter would add, for example to replace it completely. The property spring.autoconfigure.exclude (a comma list or a YAML list) adds more names without a rebuild. An excluded auto-configuration is removed before its conditions are checked.

Constructors

SpringBootApplication({List<Type> exclude = const [], List<String> excludeName = const []})
Marks main; both lists are empty by default.
const

Properties

exclude → List<Type>
@AutoConfiguration classes whose beans are not registered, such as [CacheAutoConfiguration]. A type that is not an auto-configuration class fails the start.
final
excludeName → List<String>
Auto-configuration to leave out, by name: the name of an @AutoConfiguration class ('CacheAutoConfiguration'), or of a whole module ('springBootStarterCacheAutoConfiguration'), which removes everything the starter adds. Unknown names are ignored, so a name can stay after the starter is removed.
final
hashCode → int
The hash code for this object.
no setterinherited
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