This is a Spring Boot Conversion of my past repo solution to origin financial's backend take home assignment.
The backend works with this frontend.
- Java 17
- Spring Boot 3.1
- VS Code
The Express application runs by default on http://localhost:4000
and has the following endpoints:
http://localhost:4000/api/score
- post endpoint that expects the form object below
{
"personal": {
"age": 35,
"income": 0,
"marital_status": "married"
},
"house": {
"ownership_status": "owned",
"dependents": 2
},
"vehicle": {
"year": 2018
},
"questions": {
"question1": "false",
"question2": "true",
"question3": "false"
}
}
git clone https://github.com/jdegand/origin-spring-boot-backend.git
# need java jdk installed
# cd into directory & run directly with maven or open in ide - click run button
Run the backend application first.
git clone https://github.com/jdegand/origin-angular-frontend.git
# cd into the directory
npm install
npm start
- Have to add @Valid in ApplicantData because properties are nested
- The only standard annotations which can be applied to enum's are @NotNull and @Null.
- Adding custom validation for question to ensure question answers are only 'true' or 'false' requires an implementation similar to this
- Don't think using an entity makes sense since data is not saved to a database
- Using DTO vs entity - not much practical difference - although I think it was a bigger issue in the past
- Didn't add setters to DTOs - necessary for more complicated testing logic ?
- I gitignored the maven-wrapper.jar - debatable if it should be ignored or not - The mvnw / mvnw.cmd scripts will download a maven wrapper if it is missing
- Code Coverage plugin
- More tests
- Custom Validator for questions
- Error route
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Web
- Building a RESTful Web Service - spring guide
- Serving Web Content with Spring MVC - spring guide
- Building REST services with Spring - spring guide
- VS Code Docs - java vscode
- JSON 2 CSHARP - json to pojo
- YouTube - Spring Boot Complete Tutorial - Master Class
- Github - Springboot Tutorial Repo for Spring Boot Complete Tutorial - Master Class video
- Stack Overflow - DTO or entity?
- Spring Framework Guru - requestbody annotation
- YouTube - Coding Challenge #1 - RESTful Calculator with Java Spring Boot
- Stack Overflow - return an object from a post method with spring boot
- Stack Overflow - spring boot mapping between entity and database not working
- Stack Overflow - validate requestbody
- YouTube - Spring boot Post Method Example with JSON and Postman
- Stack Overflow - option for generating getters and setters on vscode
- VS Code - java refactoring
- How to Do in Java - controller getMapping / postMapping
- YouTube - RESTful Web Service with Spring Boot - Consume and Produce JSON or XML
- Java Guides - dto validation example
- Stack Overflow - lambda to filter a boolean array
- Stack Overflow - most elegant way to check if all values in a boolean array are true
- Spring Docs - validation
- YouTube - Spring Boot | REST API Request Validation & Exception Handling Realtime Example | JavaTechie
- Stack Overflow - change spring boot dashboard project name in vscode
- Stack Overflow - validation not working with dto objects
- Stack Overflow - spring validator class does not validate the dto data
- Stack Overflow - validation nested models
- Baeldung - javax validations enums
- Stack Overflow - java string validation using enum values and annotation
- Stack Overflow - how to validate enum in dto
- YouTube - Spring Boot - Creating Custom Annotation For Validation | InterviewQA | JavaTechie
- YouTube - 13. Spring Boot | Working with enum | @Enumerated
- Stack Overflow - requestbody valid custom error message
- Fun of Programming Blog - java enum validator
- Spring Docs - rest service cors
- Stack Overflow - custom validator on java list type
- Sololean - compiler playground java
- Free Formatter - escape json
- Stack Overflow - mockMvc contentType is undefined in result action
- Medium - setting up unit testing for java in vs code with maven
- Stack Overflow - maven gitignore
- Stack Overflow - should i gitignore mvn folder in a spring boot project
- Gist - java gitignore
- Github - gitignore maven