我有春季启动应用程序,使用2个数据库.我定义了2个提供指定数据源的配置.我想让liquibase单独管理这些数据源.我定义了2个单独的更改日志文件.
问题是我无法为liquibase定义2个单独的bean.
这是我的配置类:
...
public class CCSConfiguration {
...
@Bean
@ConfigurationProperties("ccs.liquibase")
public LiquibaseProperties ccsLiquibaseProperties() {
return new LiquibaseProperties();
}
@Bean
public SpringLiquibase ccsLiquibase(LiquibaseProperties liquibaseProperties) {
...
}
...
}
...
public class CCAConfiguration {
...
@ConfigurationProperties("cca.liquibase")
public LiquibaseProperties ccaLiquibaseProperties() {
return new LiquibaseProperties();
}
@Bean
public SpringLiquibase ccaLiquibase(LiquibaseProperties liquibaseProperties) {
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
和属性:
cca:
liquibase:
change-log: classpath:config/liquibase/cca/master.xml
ccs:
liquibase:
change-log: classpath:config/liquibase/ccs/master.xml
Run Code Online (Sandbox Code Playgroud)
使用此配置,我在运行应用程序时遇到以下错误:
2017-04-11 14:26:55.664 WARN 34292 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling …Run Code Online (Sandbox Code Playgroud) 我需要有关单元测试用例的帮助。我想嘲笑静态方法write(Path path, byte[] bytes, OpenOption... options)的java.nio.file.Files类。
我试过例如。以这种方式:
PowerMockito.doReturn(path).when(Files.class, "write", path, someString.getBytes());
Run Code Online (Sandbox Code Playgroud)
在这种情况下,找不到该方法。
PowerMockito.doReturn(path).when(Files.class, PowerMockito.method(Files.class, "write", Path.class, byte[]
.class, OpenOption.class));
Run Code Online (Sandbox Code Playgroud)
这次我有UnfinishedStubbingException。
我该怎么做才能正确?
我正在尝试用Gson解析一些json,我有以下问题:
这是我的json:
[{
"label": "Check Digit",
"value": "W"
},
{
"label": "Equipment",
"value": [
"With Standard Liftgate",
"(-) Version Packages"
]
}]
Run Code Online (Sandbox Code Playgroud)
这是我的java类:
public class Decode {
private String label;
private List<String> value = new ArrayList<>();
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<String> getValue() {
return value;
}
public void setValue(List<String> value) {
this.value = value;
}
}
Run Code Online (Sandbox Code Playgroud)
如何使Gson解析它并value始终用作String数组?
java ×3
gson ×1
junit ×1
liquibase ×1
mockito ×1
powermockito ×1
spring ×1
spring-boot ×1
unit-testing ×1