0

目前我有一个 SBA(Spring Boot App 1.5.10.RELEASE),它有两个配置属性文件,比如application-default.propertiesapplication-oracle.properties. 此外,这些文件位于src/main/resources最终的 jar 文件中,BOOT-INF/classes/ 其中applilcation-oracle.properties包含如下内容:

#
# Turn off liquibase initialization.
spring.liquibase.enabled=false

# Oracle settings
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/xe
spring.datasource.username=..
spring.datasource.password=...
spring.datasource.driver-class-name=...
#
# Hibernate
spring.jpa.properties.hibernate.dialect=....
#
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true

application-default.properties看起来很相似,只是spring.liquibase.enabled没有包含它并且包含到本地 PostgreSQL 而不是 Oracle 的连接。

我的 pom 文件中依赖于 liquibase。

所以现在我想通过以下方式开始我的 SBA:

java -jar x.jar --spring.profiles.active=default ..

正如预期的那样打印出liquibase初始化正在运行..之后我想像这样启动它:

java -jar x.jar --spring.profiles.active=oracle ..

并期望通过 liquibase 的初始化不会基于给定的发生,spring.liquibase.enabled=false但与我的预期相反,它将通过 liquibase 开始初始化。

所以问题是:我是否疏忽了什么?

4

1 回答 1

0

spring boot 1.5.10 的默认属性是:

LIQUIBASE(Liquibase 属性

liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
liquibase.check-change-log-location=true # Check the change log location exists.
liquibase.contexts= # Comma-separated list of runtime contexts to use.
liquibase.default-schema= # Default database schema.
liquibase.drop-first=false # Drop the database schema first.
liquibase.enabled=true # Enable liquibase support.
liquibase.labels= # Comma-separated list of runtime labels to use.
liquibase.parameters.*= # Change log parameters.
liquibase.password= # Login password of the database to migrate.
liquibase.rollback-file= # File to which rollback SQL will be written when an update is performed.
liquibase.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used.
liquibase.user= # Login user of the database to migrate.
于 2018-03-26T13:53:19.800 回答