Home > Mobile >  Spring Boot project naming convention
Spring Boot project naming convention

Time:01-06

While creating a Spring Boot app, I thought some points regarding project name and package name in Spring Initializr. The issues:

1. When creating an app that is used to save and manipulate data, should I use api or app in the name. For example, while creating an app for saving Book data with CRUD operations, should I use book-api or book-app for a better naming convention. As the app does not serve data to public, and will be used individually, I think it seems to be better using book-app. But not sure (also it has endpoints and it may also be considered as API).

2. In Spring Initializr, when I use book-app in the name field, the package name field would be com.example.book-app. But if there is not multiple modules, I think there is no need to use book-app again in this field. For this reason I use just com.example (of course I update the domain properly, it is just for example) in the Package name field without name. Is that ok? Or should I always use Group Name (com.example.book-app) as in default format?

CodePudding user response:

  1. API (application programming interface) is a name which refers that the program you are writing provides some kind of functionality others can use, such as a library.
  2. You should always include the program name, as to minimize clashes of class names in the class-path.

You should use the book-app name as it describes an application, but it's not something mandated.

  • Related