Skip to content

Commit 1a0029a

Browse files
author
李云龙
committed
1.database automation construction
2.modify Logs default directory
1 parent c3af284 commit 1a0029a

File tree

5 files changed

+985
-2
lines changed

5 files changed

+985
-2
lines changed

moss-web/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
<artifactId>springfox-swagger-ui</artifactId>
7676
<version>2.9.2</version>
7777
</dependency>
78+
79+
<dependency>
80+
<groupId>org.liquibase</groupId>
81+
<artifactId>liquibase-core</artifactId>
82+
</dependency>
7883

7984

8085

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.xujin.moss.config;
2+
3+
import liquibase.integration.spring.SpringLiquibase;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.Configuration;
6+
7+
import javax.sql.DataSource;
8+
9+
/**
10+
* @author: liyunlong[[email protected]]
11+
* @version: V1.0
12+
* @date: 2019-05-04
13+
*/
14+
@Configuration
15+
public class LiquibaseConfig {
16+
17+
@Bean
18+
public SpringLiquibase liquibase(DataSource dataSource) throws Exception {
19+
SpringLiquibase liquibase = new SpringLiquibase();
20+
liquibase.setDataSource(dataSource);
21+
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
22+
liquibase.setContexts("default,dev,test,prod");
23+
liquibase.setShouldRun(true);
24+
return liquibase;
25+
}
26+
}

moss-web/src/main/resources/application.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@ spring:
2020
testOnReturn: false
2121
poolPreparedStatements: true
2222
maxOpenPreparedStatements: 20
23-
2423
boot:
2524
admin:
2625
## 兼容配置Spring Boot 1.X的端点和自定义的端点
2726
probed-endpoints: ["metricsInfo","metrics:metrics","infoLogFile","errorLogFile","jardeps","appInfo","health", "env", "metrics", "httptrace:trace", "httptrace", "threaddump:dump", "threaddump", "jolokia", "info", "logfile", "refresh", "flyway", "liquibase", "heapdump", "loggers", "auditevents", "mappings", "scheduledtasks", "configprops", "caches", "beans"]
27+
liquibase:
28+
change-log: classpath:config/liquibase/master.xml
29+
drop-first: false # true 优先drop整库之后,顺序执行 master.xml
30+
enabled: true
31+
check-change-log-location: true
2832

2933
server:
3034
port: 8080
3135

32-
3336
eureka:
3437
instance:
3538
leaseRenewalIntervalInSeconds: 10

0 commit comments

Comments
 (0)