Home > Back-end >  How to understand SpringBoot convention over configuration?
How to understand SpringBoot convention over configuration?

Time:11-10

First, what is the convention over configuration, convention over configuration is also referred to as programming by the agreement, is a software design pattern, designed to reduce the number of software developers need to make a decision, to obtain the advantages of simple, and do not break flexibility,
In SpringBoot convention is greater than the configuration can be from the following two aspects to understand:

Developers only regulations, a part of the application does not comply with the contract
Where there is no rule configuration, use the default configuration, to strive for the minimalist configuration as the core ideas
Article in general, the above two are in compliance with the thought of the recommended default configuration, when there are special requirements, custom configuration, so that we can greatly reduce configuration, this is the so-called "agreed,"

So what are the conventions in SpringBoot?
Maven's directory structure, the default resources folder, storage resource configuration files, SRC - the main - resources, SRC - the main - Java, the default compiler generated class is below the targe folder
Spring boot default configuration file must be, also can be application, or the properties file named yml file, and the only
Application. The default attributes in the yml, database connection information must be in the spring, the datasource: as the prefix; More environment configuration, this property can be read automatically according to the running environment different configuration files; The port number, request path, etc
  • Related