bootique-kotlin

Provides extension function and features for smooth development with Bootique and Kotlin.

View the Project on GitHub

Kotlin Extensions for Bootique and Bootique Modules

Bootique

See Extensions.kt for sources.

Extension: ConfigurationFactory.config

// Using Java Api
configurationFactory.config(SampleFactory::class.java, "sample")

// With Extension
configurationFactory.config<SampleFactory>("sample")

// Type Inference
@Singleton
@Provides
fun createAppConfiguration(configurationFactory: ConfigurationFactory): SampleFactory {
    return configurationFactory.config/* No Type Here */(configPrefix)
}

Extension: LinkedBindingBuilder.toClass

binder.bind(CommandRunner::class).toClass(CommandRunnerImpl::class)

Extension: Bootique.module, Bootique.modules

Bootique
    .app(*args)
    .module<LogbackModule>()
    .module(LogbackModule::class)
    .modules(LogbackModule::class, JettyModule::class)
    .autoLoadModules()

Bootique Jetty

Define empty config:

config {
    jetty {

    }
}

Use autocompletion to define configuration.

Use httpConnector/httpsConnector extensions to define connectors:

jetty {
    httpConnector {
        port = 4242
        host = "192.168.0.1"
        responseHeaderSize = 42
        requestHeaderSize = 13
    }
}

Bootique Logback

Define empty config:

config {
    logback {

    }
}

Number of extensions available inside config:

logback {
    useLogbackConfig = false
    debug = false
    level = LogbackLevel.warn
    logger(FactoryDSL::class, LogbackLevel.error)
    consoleAppender {
        target = ConsoleTarget.stderr
        logFormat = "[%d{dd/MMM/yyyy:HH:mm:ss}] %t %-5p %c{1}: %m%n"
    }
    appender(ConsoleAppenderFactory().apply {
        target = ConsoleTarget.stdout
    })
    fileAppender {
        file = "abc"
        timeBasedRollingPolicy {
            setFileNamePattern("Abc_%d")
        }
        fixedWindowRollingPolicy {
            setFileNamePattern("Abc_%d")
            setFileSize("10mb")
        }
        sizeAndTimeRollingPolicy {
            setFileNamePattern("mylog-%d{yyyy-MM-dd}.%i.txt")
            setFileSize("10mb")
        }
    }
}

Bootique Bom

Bootique Undertow

Bootique Cayenne

Bootique Jdbc

Bootique Jersey Client

Bootique Linkrest

Bootique Mvc

Bootique Swagger

Bootique Jersey

Bootique Shiro

Bootique Linkmove

Bootique Tapestry

Bootique Jooq

Bootique Liquibase

Bootique Flyway

Bootique Job

Bootique Kafka Client

Bootique Jcache

Bootique Curator

Bootique Metrics

Bootique Rabbitmq Client