Skip to content
 
 

Latest commit

 

History

39 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is simple project to show how to create a basic API using Java 11 + Maven + Spring Boot + PostgrSQL + Flyway.

Create new

  • Install sdkman (sdkman installs command line, https://sdkman.io/install)
    • curl -s "https://get.sdkman.io" | bash
    • source "$HOME/.sdkman/bin/sdkman-init.sh"
    • sdk version -> should print version
  • Install spring: sdk install springboot
  • Create new project: spring init --dependencies=web,data-jpa first-mvn

Install a JDBC (required to start server)

Useful commands

  • Start server dev mode: mvn spring-boot:run
  • Install pom stuff and skip tests: mvn clean install -DskipTests
  • Only install dependencies: mvn dependency:resolve

Organization

  • Controller (@RestController) -> Service (@Service) -> Dao (@Repository) -> Repo (@Repository) -> Entity (@Component)

Link to Reddit post

Some tips for real world projects (this is just a simple project)

  • Controller advise should account for each type of error
  • Response should returns JSONs (can return JSONs using Map<String, Object> body = new LinkedHashMap<>();) not strings.

About

Very basic spring-boot application for seeing how to organize a basic API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages