Bedrock

DropWizard and other useful libraries packaged for common foundation of services

License

License

GroupId

GroupId

com.github.ptomli.bedrock
ArtifactId

ArtifactId

bedrock-parent
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom
Description

Description

Bedrock
DropWizard and other useful libraries packaged for common foundation of services
Project URL

Project URL

http://github.com/ptomli/bedrock
Source Code Management

Source Code Management

http://github.com/ptomli/bedrock

Download bedrock-parent

Filename Size
bedrock-parent-1.0.0.pom 10 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.ptomli.bedrock/bedrock-parent/ -->
<dependency>
    <groupId>com.github.ptomli.bedrock</groupId>
    <artifactId>bedrock-parent</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.ptomli.bedrock/bedrock-parent/
implementation 'com.github.ptomli.bedrock:bedrock-parent:1.0.0'
// https://jarcasting.com/artifacts/com.github.ptomli.bedrock/bedrock-parent/
implementation ("com.github.ptomli.bedrock:bedrock-parent:1.0.0")
'com.github.ptomli.bedrock:bedrock-parent:pom:1.0.0'
<dependency org="com.github.ptomli.bedrock" name="bedrock-parent" rev="1.0.0">
  <artifact name="bedrock-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.ptomli.bedrock', module='bedrock-parent', version='1.0.0')
)
libraryDependencies += "com.github.ptomli.bedrock" % "bedrock-parent" % "1.0.0"
[com.github.ptomli.bedrock/bedrock-parent "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • core
  • test

A Solid Foundation

DropWizard provides a fantastic base on which you can build REST based services. Big up to @codahale and Yammer for making this available.

Bedrock takes this basis, adds some libraries and a bit more glue, and tries to make it easy to build services using the technologies I commonly use.

Bonus Features

Getting Started

	<dependency>
		<groupId>com.github.ptomli.bedrock</groupId>
		<artifactId>bedrock-core</artifactId>
		<version>2.0.0-SNAPSHOT</version>
	</dependency>

Simple Example

Below is a simple example of how you can easily integrate Spring configured beans into the DropWizard startup.

The code below:

  • Creates a ClassPathXmlApplicationContext, based on the Spring bean configuration files located in /META-INF/spring/*.xml.
  • Registers a Spring PropertySource with the Spring Environment, whose property values are resolved against the DropWizard configuration, prefixed with "config.".
  • Registers the DropWizard configuration as a Spring bean named "config".
  • Registers any HealthCheck beans, defined in Spring, with the DropWizard environment.
  • Registers any @Path annotated beans, defined in Spring, with the DropWizard environment.
    @Override
    public void run(Configuration configuration, Environment environment) {
        SpringServiceConfigurer.forEnvironment(environment)
            .withContext(ClassPathXmlApplicationContext.class, "classpath:/META-INF/spring/*.xml")
            .registerConfigurationPropertySource("config.", configuration)
            .registerConfigurationBean("config", configuration)
            .registerHealthChecks()
            .registerResources();
    }

Testing Dependencies

I'm a strong believer that consistency makes it a lot easier to deal with code. Testing is one of those areas where there tends to be, let's say, less rigorous attention to consistency. Having a good set of testing tools available, and no needing to go looking for a doodad or wotsit, tends to help keep things in line.

  • Spring Test
  • Spring Integration Test
  • AssertJ
  • Mockito

Status

Build Status Coverage Status Maven Central

License

Copyright 2013-2014 Paul Tomlin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
1.0.0