GithubHelp home page GithubHelp logo

ericfan / greensummer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from verdoso/greensummer

0.0 1.0 0.0 364 KB

A set of Spring utilities

License: GNU Lesser General Public License v2.1

Java 99.56% XSLT 0.44%

greensummer's Introduction

Green Summer

Codacy Badge Maven Central

Green Summer is a set of different utilities that can be added on top of Spring to augment the basic functionality. It started as a set of controllers and configuration that I felt tempted to copy/paste into each of my projects. So I decided to create a shared library instead. Some of the functionality might be developed in the future in Spring (Boot) itself, and then I'll be more than happy to deprecate it and move along. In the mean time, this is a brief summary of the utilities that one can find in Green Summer

  • ConfigInspectorController: A controller to show the effective configuration that is in place currently and the sources it comes from.
  • Log4JController: A controller to list/modify the Log4j2 log levels configuration at runtime.
  • LogbackController: A controller to list/modify the Logback log levels configuration at runtime.
  • HealthController: A simple controller with an actionable toggle that can be used from balancers or health checks to control whether the application should be used or not.
  • Slf4jMDCFilter: A servlet filter that adds a unique ID to all the log messages that belong to each request. This way you can track all the log messages for a given request, even if they intermingle with messages from other requests. (See Spring Boot: Setting a unique ID per request for more information)
  • ProfilingAspect: An aspect that can be easily used to profile method calls. With the appropriate AOP configuration, it can be used to profile also private methods and/or methods belonging to classes outside Spring.
  • CustomXMLHttpMessageConverter: A message converter that overrides Jaxb2RootElementHttpMessageConverter and uses a pool of Marshallers to convert your objects to XML, instead of the "a new marshaller per request" approach that the regular Jaxb2RootElementHttpMessageConverter uses. The performance difference in applications with heavy traffic is quite noticeable.
  • LoggingClientHttpRequestInterceptor: An interceptor to log the traffic back & forth when using a RestTemplate. INFO shows basic info, DEBUG includes headers and TRACE includes request and response bodies. Useful for debugging RestTemplate calls at runtime with the help of Log4JController.
  • CacheConfiguration: A configuration class for the Caffeine cache so you can initialise multiple caches using configuration properties easily.
  • MessageSourceConfiguration: A configuration utility class that helps configuring a MessageSource for your labels, so you can easily set a default locale and if changes are detected are runtime or not (very useful during development).
  • SummerXSLTView: An XSLTView that allows you to specify a result object and an XSLT. The result object is marshalled first to XML, using JAXB, and then the XSLT stylesheet is used to transform the XML to the final result. Useful to get different XML/HTML views without having to create extra Java classes.
  • SummerJoltView: A view that allows you to specify a result object and a Jolt specification. The result object is marshalled first to JSON, using Jackson, and then the Jolt specification is used to transform the JSON to the final JSON. Useful to get different JSON views without having to create extra Java classes.
  • ObjectJoiner: Just a simple convenient utility to create strings from a number of objects, specified as varargs or collection, optionally using a separator.
  • ActuatorCustomizer: An EndpointHandlerMappingCustomizer that changes the order of the media types returned from the actuator so the media types with the version number included are at the end (so regular clients recognise the response a JSON).
  • ApplicationContextProvider: A somehow hackish way to get a reference to the application context from almost any class (required by SummerJoltView).
  • SelfDiscoveryPropertySourceLocator: A PropertySourceLocator that adds the property spring.cloud.consul.discovery.hostname with the value InetAddress.getLocalHost().getCanonicalHostName() at the very beginning so Consul can use that value.
  • HazelcastConsulSessionReplicationConfiguration: A configuration class that sets up a Hazelcast cluster using Consul for other node's discovery and can also use that to configure http session replication through Hazelcast.
  • ServerPortDisplayer: A simple utility class to display the server port the container is listening to, useful when the server is set to random & unused (server.port=0).
  • DockerSecretsPropertySourceLocator: A class that can use property files defined as Docker secrets to define sensitive Spring Boot data as Spring Config Server URL & authentication, encryption keys...
  • ClusteredConcurrentIndexedCollection: A CQEngine collection where the changes in one node are replicated to the other nodes in the cluster.

The Spring integrated utilites can be enabled using the annotation @EnableSummer and specifying the appropriate parameters.

I'll be adding documentation as time permits.

greensummer's People

Contributors

verdoso avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.