Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
9128f2b9
Commit
9128f2b9
authored
Sep 24, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3915 from fabriciocolombo/liquibase
* pr/3915: Add Liquibase labels and parameters properties
parents
d0dbe937
605eb8a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
3 deletions
+64
-3
LiquibaseAutoConfiguration.java
...t/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
+3
-1
LiquibaseProperties.java
...ork/boot/autoconfigure/liquibase/LiquibaseProperties.java
+29
-1
LiquibaseAutoConfigurationTests.java
...oconfigure/liquibase/LiquibaseAutoConfigurationTests.java
+30
-1
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+2
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
View file @
9128f2b9
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -100,6 +100,8 @@ public class LiquibaseAutoConfiguration {
...
@@ -100,6 +100,8 @@ public class LiquibaseAutoConfiguration {
liquibase
.
setDefaultSchema
(
this
.
properties
.
getDefaultSchema
());
liquibase
.
setDefaultSchema
(
this
.
properties
.
getDefaultSchema
());
liquibase
.
setDropFirst
(
this
.
properties
.
isDropFirst
());
liquibase
.
setDropFirst
(
this
.
properties
.
isDropFirst
());
liquibase
.
setShouldRun
(
this
.
properties
.
isEnabled
());
liquibase
.
setShouldRun
(
this
.
properties
.
isEnabled
());
liquibase
.
setLabels
(
this
.
properties
.
getLabels
());
liquibase
.
setChangeLogParameters
(
this
.
properties
.
getParameters
());
return
liquibase
;
return
liquibase
;
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java
View file @
9128f2b9
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
liquibase
;
package
org
.
springframework
.
boot
.
autoconfigure
.
liquibase
;
import
java.util.Map
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
@@ -78,6 +80,16 @@ public class LiquibaseProperties {
...
@@ -78,6 +80,16 @@ public class LiquibaseProperties {
*/
*/
private
String
url
;
private
String
url
;
/**
* Comma-separated list of runtime labels to use.
*/
private
String
labels
;
/**
* Change log parameters.
*/
private
Map
<
String
,
String
>
parameters
;
public
String
getChangeLog
()
{
public
String
getChangeLog
()
{
return
this
.
changeLog
;
return
this
.
changeLog
;
}
}
...
@@ -150,4 +162,20 @@ public class LiquibaseProperties {
...
@@ -150,4 +162,20 @@ public class LiquibaseProperties {
this
.
url
=
url
;
this
.
url
=
url
;
}
}
public
String
getLabels
()
{
return
this
.
labels
;
}
public
void
setLabels
(
String
labels
)
{
this
.
labels
=
labels
;
}
public
Map
<
String
,
String
>
getParameters
()
{
return
this
.
parameters
;
}
public
void
setParameters
(
Map
<
String
,
String
>
parameters
)
{
this
.
parameters
=
parameters
;
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java
View file @
9128f2b9
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
liquibase
;
package
org
.
springframework
.
boot
.
autoconfigure
.
liquibase
;
import
java.util.Map
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Rule
;
...
@@ -167,4 +169,31 @@ public class LiquibaseAutoConfigurationTests {
...
@@ -167,4 +169,31 @@ public class LiquibaseAutoConfigurationTests {
assertThat
(
log
,
instanceOf
(
CommonsLoggingLiquibaseLogger
.
class
));
assertThat
(
log
,
instanceOf
(
CommonsLoggingLiquibaseLogger
.
class
));
}
}
@Test
public
void
testOverrideLabels
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"liquibase.labels:test, production"
);
this
.
context
.
register
(
EmbeddedDataSourceConfiguration
.
class
,
LiquibaseAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
SpringLiquibase
liquibase
=
this
.
context
.
getBean
(
SpringLiquibase
.
class
);
assertEquals
(
"test, production"
,
liquibase
.
getLabels
());
}
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
testOverrideParameters
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"liquibase.parameters.foo:bar"
);
this
.
context
.
register
(
EmbeddedDataSourceConfiguration
.
class
,
LiquibaseAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
SpringLiquibase
liquibase
=
this
.
context
.
getBean
(
SpringLiquibase
.
class
);
Map
<
String
,
String
>
parameters
=
(
Map
<
String
,
String
>)
ReflectionTestUtils
.
getField
(
liquibase
,
"parameters"
);
assertTrue
(
parameters
.
containsKey
(
"foo"
));
assertEquals
(
"bar"
,
parameters
.
get
(
"foo"
));
}
}
}
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
9128f2b9
...
@@ -472,12 +472,14 @@ content into your application; rather pick only the properties that you need.
...
@@ -472,12 +472,14 @@ content into your application; rather pick only the properties that you need.
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
liquibase.check-change-log-location=true # check the change log location exists
liquibase.check-change-log-location=true # check the change log location exists
liquibase.contexts= # runtime contexts to use
liquibase.contexts= # runtime contexts to use
liquibase.labels= # runtime labels to use
liquibase.default-schema= # default database schema to use
liquibase.default-schema= # default database schema to use
liquibase.drop-first=false
liquibase.drop-first=false
liquibase.enabled=true
liquibase.enabled=true
liquibase.url= # specific JDBC url (if not set the default datasource is used)
liquibase.url= # specific JDBC url (if not set the default datasource is used)
liquibase.user= # user name for liquibase.url
liquibase.user= # user name for liquibase.url
liquibase.password= # password for liquibase.url
liquibase.password= # password for liquibase.url
liquibase.parameters= # change log parameters
# JMX
# JMX
spring.jmx.default-domain= # JMX domain name
spring.jmx.default-domain= # JMX domain name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment