examples icon indicating copy to clipboard operation
examples copied to clipboard

Spring Boot Web3jSampleController

Open maksumic opened this issue 2 years ago • 0 comments

What does this PR do?

Creates a Web3jSampleRestController, which injects the already existing Web3jSampleService, to be able to retrieve the client version by doing:

GET /client/version

Further, it refactors some field-based DI to constructor-based DI, to adhere to Spring best practices. And it adds a dependency on spring-boot-starter-web to be able to run the web service.

Where should the reviewer start?

Start at Web3jSampleRestControllerTest as it covers the expected behavior. To test the changes manually, run an Ethereum client (e.g. Ganache) and go to http://localhost:8080/client/version

Screenshot from 2022-09-18 21-39-37

Why is it needed?

Because it allows the user to start the Spring Boot application with an example REST endpoint, without having to write code; while keeping the example minimal

maksumic avatar Sep 18 '22 10:09 maksumic