简体   繁体   中英

Spring Boot project naming convention

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?

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM