This is a work in progress experimenting with TDD, kotlin and spring boot 2, spring framework 5 and other stuff that strikes my fancy
I've been reading Growing Object-Oriented Software, Guided by Tests to learn how to better apply TDD for a work project. This project will offer some freedom to experiement with the concepts better, and to geek on some other fun stuff. For now I'm gonna use spcok as thats something I'm familar with, but at some point may dabble with Spek, and other kotlin based testing frameworks
Kotlin spring demo. lots of stuff to learn here http://spring.io/blog/2017/08/01/spring-framework-5-kotlin-apis-the-functional-way https://docs.spring.io/spring/docs/5.0.0.BUILD-SNAPSHOT/spring-framework-reference/html/web-reactive.html https://medium.com/@oscdj113/spring-boot-2-with-webflux-kotlin-bb1a71167591
React, kotlin and spring https://amarszalek.net/blog/2018/04/02/reactive-web-services-kotlin-spring-boot-2/
testing with WebClient and WebTestClient https://www.baeldung.com/spring-5-webclient https://www.callicoder.com/spring-5-reactive-webclient-webtestclient-examples/
This has some nice examples of WebClient, including the GET, PUT, POST, and DELETE https://dzone.com/articles/doing-stuff-with-spring-webflux
Very good overview of webflux/reactive, mentions kotlin http://projectreactor.io/docs/core/release/reference/
https://github.com/springfox/springfox/tree/master/springfox-spring-webflux
swagger with webfluxes springfox/springfox#1773 check the last entry for 3 pom entries, and one config No operations defined in spec!
I think it does not recognize the spring kotlin DSL for routes. it looks for @RestController
This https://dzone.com/articles/build-rest-apis-with-kotlin-spring-5-webflux-and-p looks like it shows a way to make it work. He uses the OpenAPI swagger stuff
not sure if kotlin or my base url path for the only controller. I get the swagger ui page but not the controller and it's endpoints. It doesn't see it for some reason
#Interesting notes
- spring has a kotlin Bean definition DSL, router DSL
- kotlin reactive extensions are part of the spring stuff, it adds a toMono() and toFlux() methods to all objects, ie "blah string".toMono(), etc
- in the gradle file note the jsr305. spring5 uses these now, and kotlin can use them to interact with java safer
- finding issues testing spring webflux with spock
- had to load the 3.0 snapshot version of springfox, most articles/issue trackers mention it makes it easier to use webfluxes
- I got it to work, mostly. It seems to not be able to read the new spring kotlin DSL for controllers. a solution I've read about seems to be using the openAPI api.json stuff
- add actuator endpoints
- add some non-webflux endpoints
- add swagger. had issues with kotlin webflux dsl (it started, didn't see the endpoints)
- refactor into a mono repo for several services
- add reactive mongo.
- local mongo
- embedded mongo for test, maybe running
- dockerfy each service, and mongo
- mongo transactions 1 https://www.baeldung.com/spring-data-mongodb-transactions
- basic spock unit tests
- spock integration tests (not testing endpoints, just handlers down.)
- spock acceptance tests - ie tests that can hit a running service at a known port/address
- spring and spock controller tests (with and without running service instances)
#Docker some resources. Memory management in a container spring boot block for docker ##TODO:
- versioning jdk. upgrade to 11
- connect to external mongo instance
- connect to local mongo instance
- connect to mongo container
- build from gradle task.