springboot 连接 postgresql
一,JPA 方式POM<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency><dependency><gro
·
一,JPA 方式
POM
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
application.yml
spring:
application:
name: shipcenter
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://xxxxx:5432/leadtrans
username: xxx
password: xxx
jpa:
generate-ddl: false
hibernate:
ddl-auto: none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
database: postgresql
show-sql: false
二,Mybatis-plus
POM
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.3.4</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
application.yml
spring:
application:
name: shipcenter
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://xxxxx:5432/leadtrans
username: xxxx
password: xxxx
mybatis-plus:
configuration:
map-underscore-to-camel-case: false #关闭驼峰转下划线
global-config:
db-config:
update-strategy: ignored #null也会更新
PS:设置一下编码,不然中文注释可能会报错
已为社区贡献9条内容
所有评论(0)