Steps of creating microservice project

Time:2020-12-20

1. Jianfu project

  • Set up a maven project
  • usedependencyManagementManagement version: lock the jar package version and play the role of version arbitration
  • Submodule can be omittedgroup、versionIf the version of the jar package used is found from the parent project, the version locked by the parent project will be used

2. Create each sub module

It can be summarized as follows:Create module, change POM, write YML, write main startup class

  • The child module specifies the dependent parent project through the parent tag
  • stay pom.xml Add thedependenciesThe jar package to which the tag is added can omit the specification of version and scope
  • stay application.yml Add the configuration information of the project in
  • Write the main startup class and mark it on the class@SpringBootApplication

3.dependencyManagementanddependenciesdifference

  • The jars in < dependencies > are added directly to the project to manage the dependency relationship (if there is a parent POM and a child POM, the child POM can onlyPassive acceptanceThe version of the parent class);
  • < dependency Management > main management version, it is very useful for subclass to inherit the same parent class, and centralized management of dependent versionDo not add dependenciesFor the version defined in it, the child POM does not necessarily inherit the version defined by the parent POM.

4. References:
Maven actual combat (6) — the difference between dependencies and dependency management

Recommended Today

Statistics In PostgreSQL

This article is similar to the source reading of an article, a preliminary introduction to the PostgreSQL statistical information module. The reason why we choose PostgreSQL instead of other databases is that PostgreSQL always performs well in various papers when we see some comparison of design estimation. Statistics collected in PG In PostgreSQL, the collected […]