-
Notifications
You must be signed in to change notification settings - Fork 24
Modules
Hammock is designed around a modular system for bringing in dependencies. It ensures that you have the right stuff available when you need it, and doesn't bring in unnecessary components.
Hammock core (ws.ament.hammock:hammock-core
) is really just configuration. For now, it simply provides the configuration of CLI arguments for you if you need it.
There are two Servlet Containers available as of now, Undertow (ws.ament.hammock:web-undertow
), Jetty (ws.ament.hammock:web-jetty
) and Apache Tomcat (ws.ament.hammock:web-tomcat
). There is also a ws.ament.hammock:web-spi
which handles the actual integration of the web server into the runtime. You should only have one of these on your classpath.
JAX-RS runtimes depend on having a servlet container available. If none are on the path, they won't be loaded. There are three JAX-RS runtimes available, RestEasy (ws.ament.hammock:rest-resteasy
), Jersey (ws.ament.hammock:rest-jersey
) and CXF (ws.ament.hammock:rest-cxf
). Each bring in the required transitive dependencies to operate.
Spark Java support is provided under ws.ament.hammock:rest-spark
. Outside of its core capabilities, Hammock adds injection support to your SparkApplication
implementation, in addition to Weld's native capabilities around SessionScoped
and RequestScoped
beans. The Spark module has been tested to work against both Undertow and Jetty, but are all designed around its servlet integration, not native main methods.
A very simple Security SPI is available as ws.ament.hammock:security-spi
. Assuming you plugin in some basic identity information, it can do role checks, logged in checks for you. This is designed to be extended and used to access other frameworks, e.g. Shiro or Keycloak.
The Microprofile Distribution has its own page
Support for metrics is based on Metrics CDI and automatically registers the Metrics Servlet via the AdminServlet
. You can configure the URI by overriding the property metrics.uri
, just make sure you include a /*
in the end of the base.
Support for Arquillian is provided as a test dependency, ws.ament.hammock:test-arquillian
. It expects that you export a JAR archive and will enrich it with additional dependencies from your classpath for your test code to run. In addition, a @ArquillianResource URI
injection point is available, with the host and port of your running webserver during tests.
JPA Integration has its own page
Along with JPA support, Flyway integration is provided by Hammock. A CDI bean will be installed when Flyway is found on the classpath and the JPA module is leveraged. On application startup (in the AfterBeanDiscovery
phase), the life cycle methods defined by flyway.execute
will be run against the flyway instance. By default, migrate
is run. The methods are executed in the order defined by this configuration.
Flyway integration is purely based on configuration. Any flyway.*
property discovered in your configuration will be applied to the Flyway object.
As of 1.1, Flyway integration is provided by the util-flyway
module. This component provides an injection target for @Inject Flyway flyway
Hammock provides a custom configuration bean for Artemis' CDI client, allowing you to configure the client from any configuration source you have provided. The artifact is ws.ament.hammock:messaging-artemis
. Click here for full details of Apache ActiveMQ Artemis' Support for CDI
There's a page dedicated to RabbitMQ Integration