| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project, implement instance of basic feature,
you maybe want use for App base on Spring-boot
1 - check active profile on dev
2 - run postgre sql on 5432 and create database myapp
3 - run app
4 - app.generator.enabled properties set to true, when you want to generate fake data
1 - check active profile on docker and package project
2 - create image from app: docker build -t springapp:latest .
3 - run app: docker compose run
1 - use AppException for define your own error Exception
2 - user HttpExceptionModel for define your own error message and show to client
3 - use HttpErrorCode for unifying error code in project
1 - create your own validation type
2 - define your own validation process for entity
3 - use "@validator" annotation on field of entity for validate
4 - log for validation and save error-message in log file
1 - query clause, order for result and pagination can define in client Request as queryString and handle in AbstractController
2 - buildNativeQueryCondition method in Utils class use for create native query base on request queryString
3 - dynamic order and direction for sort data handle in daoRepository
4 - more detail about search feature, see searchEngineV2.drawio
5 - sample rest search request:
http://localhost:9090/api/v2/user/search?firstName=h&orderBy=firstName_asc, gender_desc&page=1&size=5
1 - query clause, order for result and pagination can define in client Request as queryString and handle in AbstractController
2 - define Quartet from javaTuples lib that use for define name of field from client, name of field in model, sqlOperation and sqlCondition
3 - define Sort.Order object of spring with getSortOrderFromPagedQuery method to use for order by Clause
4 - then use getUserQueryWithCriteriaBuilder in userRepository for create query and get Result
5 - sample rest search request:
http://localhost:9090/api/v2/user/search?firstName=h&orderBy=firstName_asc, gender_desc&page=1&size=5
1 - generate sample data baseOn model with javaFaker
2 - Spock framework use for test
3 - sample test define in test directory with groovy language
4 - Swagger Api for show details of endpoints
5 - In order to change swagger url, you must be change springdoc.swagger-ui.path property in application-dev.properties
6 - TestContainer for run db as dockerImage, properties config exist in application-test.properties
1 - choose between use simpleDataSource or HikariCp datasource
2 - you can customize properties for dataSource in application.properties
if you want to use encrypt password in config file for access database, you must follow below statement.
1 - use jasypt for generate encrypted database password with secret-key
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input={password} password={secret-key} algorithm=PBEWithMD5AndTripleDES
2 - add output into application.properties
note: I use 'ENC()' as convention to use check password for decrypt or not.
normal datasource:
demo.datasource.password="ENC({output})"
hikari datasource:
hikari.dataSource.password="ENC({output})"
3 - run program and add in program environment secret-key:
--jasypt.encryptor.password={secret-key}
notice: that name of bean in BeanConfig must be equal with name of key in properties file.
| Back | FazBrowse Home | New Git URL |