Skip to content

Commit

Permalink
spring database
Browse files Browse the repository at this point in the history
  • Loading branch information
wave.he committed Oct 22, 2023
1 parent b070926 commit ecd5f5a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spring-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ extra["springCloudVersion"] = "2022.0.4"
dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
// implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-oauth2-authorization-server")
implementation("org.springframework.boot:spring-boot-starter-web-services")
implementation("io.micrometer:micrometer-tracing-bridge-brave")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("io.zipkin.reporter2:zipkin-reporter-brave")
// implementation("org.springframework.boot:spring-boot-starter-oauth2-authorization-server")
implementation("org.springframework.boot:spring-boot-starter-web")
// implementation("io.micrometer:micrometer-tracing-bridge-brave")
// implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
// implementation("io.zipkin.reporter2:zipkin-reporter-brave")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.2")
implementation("org.springframework.cloud:spring-cloud-config-server")
implementation("org.springframework.cloud:spring-cloud-starter-config")
// implementation("org.springframework.cloud:spring-cloud-config-server")
// implementation("org.springframework.cloud:spring-cloud-starter-config")
implementation("org.springframework.session:spring-session-jdbc")
compileOnly("org.projectlombok:lombok")
runtimeOnly("com.mysql:mysql-connector-j")
Expand Down
17 changes: 17 additions & 0 deletions spring-demo/src/main/kotlin/com/example/springdemo/pojo/Beans.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.springdemo.pojo

import org.springframework.context.annotation.PropertySource
import org.springframework.stereotype.Component

/**
* @param id : 物流单号
* @param deliverCompany : 物流公司
* @param status : 物流状态
*/
@PropertySource("classpath:/jdbc.properties")

data class Courier(
val id: Int,
val deliverCompany: String,
val status: String,
)
29 changes: 29 additions & 0 deletions spring-demo/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
# mysql
spring.datasource.url=jdbc:mysql://localhost:3306/mysql
spring.datasource.username=admin
spring.datasource.password=mysql-adm
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

# Logging settings
logging.level.root=WARN
logging.level.org.springframework.boot=INFO

# mybatis

spring.mybatis.mapper-locations=classpath:mapper/*.xml

spring:
datasource:
url: jdbc:mysql://127.0.0.1/ST?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver

application:
name: studb

server:
port: 8080

mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.example.studb.entity
5 changes: 5 additions & 0 deletions spring-demo/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
server:
# port访问的端口
port: 8888
servlet:
context-path: /

0 comments on commit ecd5f5a

Please sign in to comment.