目前我有一个SBA(Spring Boot App 1.5.10.RELEASE),它有两个配置属性文件,如application-default.properties
和application-oracle.properties
。此外,这些文件位于src/main/resources
中,它们最终位于BOOT-INF/classes/
中生成的jar文件中
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进行的inialization不会基于给定的spring.liquibase.enabled=false
发生,但与我的期望相反,它将通过liquibase开始初始化。
所以问题是:我是否疏忽了什么?
答案 0 :(得分:0)
Default properties for spring boot 1.5.10是:
LIQUIBASE(LiquibaseProperties)
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.