前言

第一次用postgres数据库,如何连接

YML

server:
port: 8081
spring:
http:
multipart:
enabled: true
maxFileSize: 10Mb
maxRequestSize: 10Mb
mvc:
hiddenmethod:
filter:
enabled: true
application:
name: webapi
datasource:
url: jdbc:postgresql://127.0.0.1:12345/dateName
username: abc
password: efj
driver-class-name: org.postgresql.Driver
druid:
proxy-filters:

POM

依赖postgres启动器

<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.18</version>
</dependency>