Skip to content

Instantly share code, notes, and snippets.

@mike-neck
Last active April 23, 2019 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mike-neck/5f1c48226931a7d8eb859d45fcc33302 to your computer and use it in GitHub Desktop.
Save mike-neck/5f1c48226931a7d8eb859d45fcc33302 to your computer and use it in GitHub Desktop.
import groovy.transform.Canonical
import org.springframework.http.converter.json.*
import com.fasterxml.jackson.databind.*
@Canonical
class Bar {
String fooBar
}
@RestController
@RequestMapping('/foo')
class Foo {
@PutMapping(consumes = 'application/json', produces = 'application/json')
def put(@RequestBody Bar bar) {
println(bar)
bar
}
}
@Configuration
class Config {
@Bean
ObjectMapper objectMapper() {
def mapper = new ObjectMapper()
mapper.propertyNamingStrategy = PropertyNamingStrategy.SNAKE_CASE
mapper
}
}
#!/bin/env bash
sdk i springboot 2.1.4.RELEASE
spring run app.groovy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment