github-java-client icon indicating copy to clipboard operation
github-java-client copied to clipboard

Spring Boot config

Open bguedel opened this issue 4 years ago • 1 comments

I think the docs are probably still lacking OR I just didnt read them well enough; More likely there is no spring specific docs anyways...

Just posting this issue to help people get started with this with a spring boot app that handles webhooks.

import com.fasterxml.jackson.databind.Module; // Need this b/c by default java will want to use the java.lang.Module.
import com.spotify.github.jackson.GithubApiModule;

@Configuration
public class Configuration {
    /**
     * Need to register this bean so that isodates based through the webhook are understood by jackson.
     */
    @Bean
    public Module githubApiModule() {
        return new GithubApiModule();
    }
}
spring:
  jackson:
    property-naming-strategy: SNAKE_CASE # by default jackson wants LOWER_CAMEL_CASE, the events are not configured to deser using snakecase. This configures jackson to expect snakecase instead of camelcase.

These are 2 kind of "gotchas" that we ran into while trying to use this project for webhooks.

bguedel avatar May 12 '21 23:05 bguedel