-
Notifications
You must be signed in to change notification settings - Fork 7
Code structure
Yoom Lam edited this page Jun 1, 2022
·
15 revisions
Open this project in an IDE, like IntelliJ.
- initial files provided by LHDI's Java Starter Kit in PR #8
- software changes in Current Software State
-
settings.gradle
: includes subdirectories as Gradle subprojects -
build.gradle
in the project root,api
, andapp
subdirectories -
buildSrc
subdirectory: LHDI Starter Kit provides Gradle plugins - Run the software and browse to http://localhost:8080/swagger to see the OpenAPI spec
Based on build.gradle
files in each directory, here's the rough subproject dependencies:
-
app
- main@SpringBootApplication
-
api
- annotated API, used to populate OpenAPI doc; defines request and response POJOs -
controller
- defines@RestController
classes (which implement api classes) and@Mapper
classes (which convertservice.model
objects from/to request/response POJOs)api
service:provider
service:spi
-
persistence:model
- defines DB@Entity
classes and DB query methods (the implementation of which is inpersistence:impl
) -
persistence:impl
- implements DBRepository
interfacespersistence:model
-
service:provider
- implementsservice:spi
; persistsservice.model
objects to/from DB using@Entity
classespersistence:model
-
service:spi
- used by controllers -
tests-data-factory
- provides factories used in tests
service:spi
-
Added in PR #63 as a separate container for Ruby services from the RRD prototype.
Contains the code for the abd_vro-service-ruby
package (container image).
There are tests in LayeredArchitectureTest
to check for undesirable dependencies:
Rule 'Layered architecture consisting of
layer 'API' ('gov.va.starter.example..api..')
layer 'API-Requests' ('gov.va.starter.example..api..requests..')
layer 'API-Responses' ('gov.va.starter.example..api..responses..')
layer 'Controllers' ('gov.va.starter.example..controller..')
layer 'SPI' ('gov.va.starter.example..service.spi..')
layer 'Services' ('gov.va.starter.example..service.provider..')
layer 'Persistence' ('gov.va.starter.example..persistence..')
where layer 'API' may only be accessed by layers ['Controllers']
where layer 'API-Requests' may only be accessed by layers ['Controllers', 'API']
where layer 'API-Responses' may only be accessed by layers ['Controllers', 'API']
where layer 'Controllers' may not be accessed by any layer
where layer 'SPI' may only be accessed by layers ['Controllers', 'Services']
where layer 'Persistence' may only be accessed by layers ['Services']'
For more description, check out LHDI's doc on project structure.