すべてのプロパティ
spring_boot_dart が読むすべてのプロパティと、どの設定ファイルを読むかを決める spring_core_dart のキー (同じ起動の中で読まれます) です。各行には、キー、その型、デフォルト、働き、そして解説するページを示します。
使う理由
起動に関わるすべてのキーを列挙した唯一の場所です。それらを読むクラス (spring_boot_dart の MainProperties、JsonProperties、MessagesProperties...、spring_core_dart の ConfigProperties と ProfilesProperties) は lib/spring_gen/spring_metadata.json も生成するため、補完機能のあるエディターでも同じキーが候補に出て、説明がコードの読むものとずれることもありません。
例
サーバーの実際的な設定を、両方の形式で:
# lib/resources/application.yml
spring:
application:
name: neon-books
main:
banner-mode: log
log-startup-info: true
lazy-initialization: false
register-shutdown-hook: true
allow-bean-definition-overriding: false
lifecycle:
timeout-per-shutdown-phase: 20s
profiles:
group:
prod: [eu, monitoring]
config:
import:
- resources:db.yml
- optional:file:./local.yml
- optional:configtree:/run/secrets/
autoconfigure:
exclude: [ApplicationAvailabilityAutoConfiguration]
json:
property-naming-strategy: SNAKE_CASE
default-property-inclusion: non_null
time-zone: UTC
messages:
basename: messages,i18n/errors
fallback-to-system-locale: false
logging:
level:
root: info
neon.checkout: debug
# lib/resources/application.properties
spring.application.name=neon-books
spring.main.banner-mode=log
spring.main.log-startup-info=true
spring.main.lazy-initialization=false
spring.main.register-shutdown-hook=true
spring.main.allow-bean-definition-overriding=false
spring.lifecycle.timeout-per-shutdown-phase=20s
spring.profiles.group.prod=eu,monitoring
spring.config.import=resources:db.yml,optional:file:./local.yml,optional:configtree:/run/secrets/
spring.autoconfigure.exclude=ApplicationAvailabilityAutoConfiguration
spring.json.property-naming-strategy=SNAKE_CASE
spring.json.default-property-inclusion=non_null
spring.json.time-zone=UTC
spring.messages.basename=messages,i18n/errors
spring.messages.fallback-to-system-locale=false
logging.level.root=info
logging.level.neon.checkout=debug
値の書き方
- 期間:
30s、500ms、5m、1h、2d、または ISO 8601 (PT30S)。単位のない数値はミリ秒です。ただし、表に秒と書かれている場合は例外です。
- 真偽値:
true/false (on、off、yes、no、1、0 も可)。それ以外は起動を止めます。
- 列挙値: 大文字小文字も区切り文字も問いません (
console、CONSOLE。non_null、NON_NULL)。
- リスト: カンマ区切りか YAML のリストです。優先度の高いソースで指定したリストは、リスト全体を置き換えます。
- 緩い名前:
spring.main.lazy-initialization、spring.main.lazyInitialization、SPRING_MAIN_LAZYINITIALIZATION は同じキーです。
- 早期に読まれるもの: 早期 と記した
spring.config.* のキーは、コマンドライン、--dart-define、環境変数、SPRING_APPLICATION_JSON、デフォルトプロパティからだけ読まれ、設定ファイルからは決して読まれません。
コマンドライン、環境変数、--dart-define を参照してください。
spring.config.*: どのファイルを読むか
| キー |
型 |
デフォルト |
意味 |
spring.config.name |
List<String> |
application |
早期。 設定ファイルのベース名。後の名前が優先される → 設定ファイル |
spring.config.location |
ロケーション |
optional:resources:/;optional:resources:/config/、optional:file:./;optional:file:./config/;optional:file:./config/*/ |
早期。 デフォルトのロケーションを置き換える。, はグループを区切り、; はロケーションを一つのグループにまとめる → 設定ファイル |
spring.config.additional-location |
ロケーション |
なし |
早期。 ロケーションの後に検索されるグループ。そのためそれらより優先される → 設定ファイル |
spring.config.on-not-found |
fail / ignore |
fail |
早期。 ignore はすべてのロケーションを任意にする → 設定ファイル |
spring.config.import |
ロケーションの List<String> |
なし |
追加の設定: ファイル、ディレクトリ、configtree:、https://、package:、asset:。optional: も可。ファイルの中、またはコマンドライン (その場合すべてのロケーションより上にインポートされる) に書く → インポート |
spring.config.activate.on-profile |
プロファイル式 |
なし |
ドキュメントの中で: 式が一致するとドキュメントが適用される → プロファイル |
spring.config.activate.on-cloud-platform |
CloudPlatform |
なし |
ドキュメントの中で: そのプラットフォームでドキュメントが適用される (kubernetes、heroku、cloud-foundry、azure-app-service、amazon-ecs、nomad、sap、none) → プロファイル |
spring.profiles.*: プロファイル
| キー |
型 |
デフォルト |
意味 |
spring.profiles.active |
List<String> |
なし |
有効なプロファイル。キーを持つ最初のソースが優先される。プロファイルのファイルでは使えない → プロファイル |
spring.profiles.include |
List<String> |
なし |
有効なプロファイルに追加されるプロファイル。すべてのソースから → プロファイル |
spring.profiles.default |
List<String> |
default |
有効なプロファイルがない間に使われるプロファイル → プロファイル |
spring.profiles.group.<name> |
List<String> |
なし |
<name> を有効にすると、これらも有効になる。グループは入れ子にできる → プロファイル |
spring.profiles.validate |
bool |
true |
プロファイル名をチェックする (英字、数字、-_.+@。英字か数字で始まり、終わる) → プロファイル |
spring.main.*: 起動
| キー |
型 |
デフォルト |
意味 |
spring.main.banner-mode |
console / log / off |
console、または SpringApplication(bannerMode:) |
バナーの出力先。false (YAML の off) は off → SpringApplication |
spring.main.log-startup-info |
bool |
true |
Starting ...、有効なプロファイル、Started ... in N seconds の行をログに出す → SpringApplication |
spring.main.lazy-initialization |
bool |
false |
すべてのシングルトンを最初に使われたときに生成する。LazyInitializationExcludeFilter の Bean は一部を即時生成のままにする → SpringApplication |
spring.main.register-shutdown-hook |
bool |
false (Spring Boot: true) |
SIGINT または SIGTERM でコンテキストを閉じ (VM のみ)、130 または 143 で終了する。SpringApplication(registerShutdownHook:) より優先される → シャットダウン |
spring.main.allow-bean-definition-overriding |
bool |
false |
起動を失敗させる代わりに、Bean 定義が同じ名前の別の定義を置き換えられるようにする → SpringApplication |
spring.main.cloud-platform |
CloudPlatform または none |
環境から検出 |
クラウドプラットフォームを強制するか、検出を無効にする → プロファイル |
spring.main.startup-checks.enabled |
bool |
未設定: デバッグビルドとプロファイルビルド |
アプリケーションを書き出すときにジェネレーターが読みます (プロファイルのない application.yml または application.properties で)。実行時には読みません。スターターの起動時チェック (data スターターの transactionValidator と dataFailureAnalyzer、cache スターターの cacheOperationValidator、edge スターターの警告のリスト) がビルドに含まれるかどうか。true: すべてのビルドに含める。false: どのビルドにも含めない。コードは一切ない。未設定: デバッグビルドとプロファイルビルドだけ。リリースビルドではコンパイル時に取り除かれ、チェックが見つけたはずの誤りは、起動時ではなく最初の呼び出しで失敗する → ビルドから外すモジュール |
spring.main.web-application-type=none は spring_boot_starter_web が読みます (サーバーは起動しません)。spring_boot_starter_web を参照してください。
spring.application.*、spring.banner.*
| キー |
型 |
デフォルト |
意味 |
spring.application.name |
String |
なし: 起動ログの行では application |
アプリケーションの名前: コンテキストの ID と、起動ログの行の名前 → SpringApplication |
spring.application.json |
JSON オブジェクト |
なし |
一つの JSON オブジェクトとしてのプロパティ。SPRING_APPLICATION_JSON としても指定できる。環境変数より上に置かれる → ソース |
spring.banner.location |
ロケーション |
resources:banner.txt |
バナーファイル。${spring-boot.version}、${spring-boot.formatted-version}、その他の ${...} は置き換えられる → SpringApplication |
| キー |
型 |
デフォルト |
意味 |
spring.autoconfigure.exclude |
List<String> |
なし |
適用しない自動構成。クラス名またはモジュール名で。@SpringBootApplication(exclude:, excludeName:) に追加される → 自動構成 |
spring.lifecycle.timeout-per-shutdown-phase |
Duration |
30s |
一つのシャットダウンフェーズの Bean が停止するのをコンテキストが待つ時間 → シャットダウン |
spring.devtools.restart.enabled |
bool |
true |
生成されたコードが変わったとき、Dart VM のホットリロードがコンテキストを再起動するかどうか → ホットリロード |
spring.task.execution.isolates.*: タスクエグゼキューター
isolateTaskExecutor Bean のプールです。Spring Boot で対応するのは、スレッドのための spring.task.execution.pool.* です。
| キー |
型 |
デフォルト |
意味 |
spring.task.execution.isolates.core-size |
int |
未設定: マシンのプロセッサー数より一つ少ない数。少なくとも一つ |
タスクがキューで待つようになる前に起動される isolate の数 → タスクエグゼキューター |
spring.task.execution.isolates.max-size |
int |
未設定: core-size と同じ数 |
isolate の最大数。キューがいっぱいのときにだけ達する |
spring.task.execution.isolates.queue-capacity |
int |
未設定: いくつでも |
isolate を待てるタスクの数。未設定の場合、プールは core-size を超えて増えない |
spring.task.execution.isolates.keep-alive |
Duration |
60s |
アイドル状態の isolate が停止されるまで残る時間 |
spring.task.execution.isolates.allow-core-timeout |
bool |
true |
最初の core-size 個の isolate も、アイドル状態のときに停止するかどうか |
spring.task.execution.isolates.name-prefix |
String |
task- |
ログでの isolate の名前。番号が付く: task-1。Web サーバーのプールの isolate では、その名前の後に付く: isolate-2-task-1 |
spring.json.*: ObjectMapper
| キー |
型 |
デフォルト |
意味 |
spring.json.property-naming-strategy |
SNAKE_CASE / UPPER_SNAKE_CASE / UPPER_CAMEL_CASE / LOWER_CAMEL_CASE / LOWER_CASE / KEBAB_CASE / LOWER_DOT_CASE |
LOWER_CAMEL_CASE |
フィールド名を JSON の名前にする方法 |
spring.json.default-property-inclusion |
always / non_null / non_absent / non_empty / non_default |
always |
書き出すプロパティ |
spring.json.time-zone |
String |
なし: 各日時はそれ自身のタイムゾーン |
UTC、Z、または固定オフセット (+02:00)。名前付きのタイムゾーンは起動を止める |
spring.json.serialization.indent-output |
bool |
false |
整形した JSON |
spring.json.serialization.write-dates-as-timestamps |
bool |
false |
DateTime を小数部付きのエポック秒として |
spring.json.serialization.write-durations-as-timestamps |
bool |
false |
Duration を秒として |
spring.json.serialization.write-date-timestamps-as-nanoseconds |
bool |
true |
小数部付きのタイムスタンプ。false: ミリ秒 |
spring.json.deserialization.read-date-timestamps-as-nanoseconds |
bool |
true |
整数のタイムスタンプを秒として読む。false: ミリ秒 |
spring.json.deserialization.fail-on-unknown-properties |
bool |
false |
クラスにない JSON のプロパティがあると読み込みが失敗する |
spring.json.deserialization.accept-float-as-int |
bool |
true |
int への 1.5 は切り捨てられる。false は拒否する |
spring.json.deserialization.fail-on-null-for-primitives |
bool |
true |
nullable でない int、double、num、bool への null で読み込みが失敗する |
spring.json.mapper.sort-properties-alphabetically |
bool |
true |
プロパティを JSON の名前で並べ、コンストラクターのパラメーターを先にする |
spring.json.mapper.default-view-inclusion |
bool |
false |
@JsonView のないプロパティをビュー付きで書き出す |
spring.json.datatype.datetime.write-dates-as-timestamps |
bool |
serialization. の値 |
Spring Boot 4 の名前。serialization. のキーより優先される |
spring.json.datatype.datetime.write-durations-as-timestamps |
bool |
serialization. の値 |
serialization. のキーより優先される |
spring.json.datatype.datetime.write-date-timestamps-as-nanoseconds |
bool |
serialization. の値 |
serialization. のキーより優先される |
spring.json.datatype.datetime.read-date-timestamps-as-nanoseconds |
bool |
deserialization. の値 |
deserialization. のキーより優先される |
spring.json.schemas[n].location |
String |
なし |
アプリケーションの JSON Schema。resources:schemas/order.json、https://、github:owner/repo/path@ref。ビルドがそのクラスを書き出し、リモートのものをダウンロードします → JSON Schema の Bean |
spring.json.schemas[n].sha256 |
String |
なし |
リモートのスキーマの SHA-256 (十六進)。ビルドは別のものを拒否します |
spring.json.schemas[n].prefix |
String |
なし |
スキーマのクラスの名前の先頭に付くもの |
spring.json.schemas[n].name |
String |
スキーマの title |
ルートクラスの名前 |
spring.json.schemas-registry.properties |
bool |
true |
false: spring.json.schemas、@JsonSchemaSource、JsonSchema の Bean のスキーマをレジストリに入れない |
それ以外の spring.json.* のキーは警告されて無視されます。組み込みの Bean を参照してください。
spring.messages.*: メッセージソース
| キー |
型 |
デフォルト |
意味 |
spring.messages.basename |
List<String> |
messages |
lib/resources/ の下のベース名。i18n/errors または i18n.errors |
spring.messages.encoding |
文字セット |
UTF-8 |
ファイルのエンコーディング。不明なものは起動を止める |
spring.messages.cache-duration |
Duration。単なる数値は秒 |
永久に保持 |
読み込んだファイルを再び読むまで保持する時間 |
spring.messages.fallback-to-system-locale |
bool |
true |
ロケールなしのファイルの前に、システムのロケールを試す |
spring.messages.use-code-as-default-message |
bool |
false |
見つからないキーは、失敗する代わりにキーを返す |
spring.messages.always-use-message-format |
bool |
false |
引数のないメッセージも書式化するため、'' は ' になる |
spring.messages.default-locale |
ロケール |
なし |
システムのロケールの前に試すロケール (Spring Boot にはない) |
spring.messages.common-messages |
ロケーションの List<String> |
なし |
すべてのロケールで共有するテキスト。後のファイルが優先される |
組み込みの Bean を参照してください。
spring.resources.*: lib/resources/ のファイルの配布
| キー |
型 |
デフォルト |
意味 |
spring.resources.embed.exclude |
lib/resources/ 以下の glob のリスト (content/**) |
なし |
ビルドがバイナリーに埋め込まないファイル。Flutter アプリは、同じ resources: の場所の下で Flutter のアセットとしてそれらを読みます。そのディレクトリを flutter: assets: の下に宣言してください。設定 (application*、*.properties、config/) は常に埋め込まれます。ジェネレーターが読みます。 |
spring.resources.prefetch.locations |
lib/resources/ 以下の glob のリスト |
なし |
Flutter の Web アプリが一度だけダウンロードする 1 つのファイルに、ビルドが入れるテキストファイル (まとめてダウンロードする)。ジェネレーターが読みます。 |
spring.resources.prefetch.stage |
app、tasks |
app |
app: アプリが表示されたあと。tasks: スプラッシュの裏で、スプラッシュはそれを待ちます |
spring.resources.prefetch.delay |
期間 |
1s |
アプリが表示されてからどれだけ後か (stage: app) |
spring.observations.annotations.enabled |
真偽値 |
false |
@Observed を有効にするか。true ならビルドにアドバイザーが入り、@Observed の付いたビーンごとにプロキシを書き出します。なければプロキシは一切ありません (オブザベーションと起動)。ジェネレーターが読みます。 |
埋め込みリソースを参照してください。
logging.*: レベル
| キー |
型 |
デフォルト |
意味 |
logging.level.root (または logging.level) |
レベル |
info |
自分のレベルを持たないすべてのロガーのレベル |
logging.level.<logger> |
trace / debug / info / warn / error / fatal / off |
継承 |
ロガーとその下のロガーのレベル。変数としては LOGGING_LEVEL_<LOGGER> |
logging.group.<group> |
List<String> |
web と sql が定義済み |
logging.level.<group> がまとめて設定するロガー名 |
出力 (logging.pattern.*、logging.file.*、logging.threshold.*...) は spring_boot_starter_logging の担当です。ログレベル を参照してください。
プレフィックスのないキー
| キー |
型 |
デフォルト |
意味 |
debug |
任意。false 以外なら有効 |
なし |
--debug は条件評価レポートをログに出し、フレームワークのロガーを debug にする → 条件 |
trace |
任意。false 以外なら有効 |
なし |
--trace はフレームワークのロガーを trace にする → ログレベル |
spring.remote.*: 設定によるダウンロード
| キー |
型 |
デフォルト |
意味 |
spring.remote.allow-insecure |
bool |
false |
設定が指定するダウンロード (Flutter のテーマ、画像、ページローダー) に、http:// と不正な証明書の https:// を許可する。警告がそれらを列挙する。これがないと、安全でないアドレスは起動を止める。spring.config.import には使われない |
独自の意味を持つ環境変数
| 変数 |
意味 |
SPRING_APPLICATION_JSON |
一つの JSON オブジェクトとしてのプロパティ |
SPRING_PROFILES_ACTIVE、SPRING_CONFIG_IMPORT、SPRING_CONFIG_LOCATION... |
上記のキーの緩い形 |
KUBERNETES_SERVICE_HOST と KUBERNETES_SERVICE_PORT、DYNO、VCAP_APPLICATION、VCAP_SERVICES、WEBSITE_*、ECS_CONTAINER_METADATA_URI(_V4)、NOMAD_ALLOC_ID、HC_LANDSCAPE |
クラウドプラットフォームの検出 → プロファイル |
名前が変わったキー
spring.jackson.*、spring.cloud.openfeign.*、spring.servlet.multipart.*、server.servlet.*、logging.logback.rollingpolicy.*、spring.flyway.* は起動を止め、新しいキー (spring.json.*、spring.feign.*、spring.web.multipart.*、server.*、logging.file.rolling-policy.*、spring.sql.migration.*) を示します。名前が変わったプロパティ を参照してください。
読まれないキー
spring.main.allow-circular-references (循環は常にエラー)、none 以外の spring.main.web-application-type の値、spring.aop.*、spring.task.execution.isolates.* 以外の spring.task.execution.*、spring.task.scheduling.pool.*、logging.config、logging.structured.*、そして上記以外の spring.json.* のキー。
関連項目