Skip to main content

TW AppDefaults

Tegral Web AppDefaults is a feature for Tegral-based applications.

Package information
Package nameCatalog dependencyFull Gradle name
tegral-web-appdefaultstegralLibs.web.appdefaultsguru.zoroark.tegral:tegral-web-appdefaults:VERSION

It provides sane defaults for Web applications. Most notably:

  • It provides the DefaultKtorApplication class, which is a KtorApplication implementation that uses the Tegral Web configuration and sets up basic features like content negotiation with Jackson.

  • It provides the KeepAliveService class, which is a service that simply keeps the application alive while the application is started. This is required for Ktor applications, since all threads used by Ktor are daemon threads which do not actually keep the JVM running.

  • It also provides a default configuration class, meaning that you do not have to define your own Config class if you intend on only using the [tegral] section.

  • It automatically configures the default loggers for a better out-of-the-box experience. For logger configuration, see the Tegral Logging feature.

  • It sets up a service that will stop the application in case a JVM shutdown hook is received (e.g. when Ctrl+C-ing the application).

The AppDefaults feature also has a dependency on the Tegral Services feature and on Tegral Web Controllers and sets up the [tegral.web] configuration section (i.e. WebConfiguration)

AppDSL automatically installs AppDefaults, meaning that you do not need to install AppDefaults yourself if you use AppDSL.