Polish
This commit is contained in:
@@ -57,9 +57,11 @@ public class CouchbaseAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(Validator.class)
|
||||
public ValidatingCouchbaseEventListener validationEventListener(Validator validator) {
|
||||
public ValidatingCouchbaseEventListener validationEventListener(
|
||||
Validator validator) {
|
||||
return new ValidatingCouchbaseEventListener(validator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -74,8 +74,8 @@ public class ProjectInfoAutoConfiguration {
|
||||
|
||||
protected void bindPropertiesTo(Object target, Resource location, String prefix)
|
||||
throws BindException, IOException {
|
||||
PropertiesConfigurationFactory<Object> factory =
|
||||
new PropertiesConfigurationFactory<Object>(target);
|
||||
PropertiesConfigurationFactory<Object> factory = new PropertiesConfigurationFactory<Object>(
|
||||
target);
|
||||
factory.setConversionService(this.conversionService);
|
||||
factory.setTargetName(prefix);
|
||||
Properties gitInfoProperties = PropertiesLoaderUtils.loadProperties(location);
|
||||
@@ -89,7 +89,6 @@ public class ProjectInfoAutoConfiguration {
|
||||
return conversionService;
|
||||
}
|
||||
|
||||
|
||||
static class GitResourceAvailableCondition extends SpringBootCondition {
|
||||
|
||||
private final ResourceLoader defaultResourceLoader = new DefaultResourceLoader();
|
||||
@@ -125,7 +124,8 @@ public class ProjectInfoAutoConfiguration {
|
||||
if (epoch != null) {
|
||||
return new Date(epoch);
|
||||
}
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX", Locale.US);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX",
|
||||
Locale.US);
|
||||
try {
|
||||
return format.parse(s);
|
||||
}
|
||||
@@ -145,10 +145,11 @@ public class ProjectInfoAutoConfiguration {
|
||||
try {
|
||||
return Long.parseLong(s) * 1000;
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
catch (NumberFormatException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ public class CouchbaseRepositoriesAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void disableRepository() {
|
||||
load(DefaultConfiguration.class, "spring.data.couchbase.repositories.enabled=false");
|
||||
load(DefaultConfiguration.class,
|
||||
"spring.data.couchbase.repositories.enabled=false");
|
||||
assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(0);
|
||||
}
|
||||
|
||||
@@ -87,14 +88,12 @@ public class CouchbaseRepositoriesAutoConfigurationTests {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@TestAutoConfigurationPackage(City.class)
|
||||
static class CouchbaseNotAvailableConfiguration {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@TestAutoConfigurationPackage(City.class)
|
||||
@Import(CouchbaseTestConfiguration.class)
|
||||
|
||||
@@ -86,7 +86,6 @@ public class ProjectInfoAutoConfigurationTests {
|
||||
assertThat(gitInfo).isSameAs(this.context.getBean("customGitInfo"));
|
||||
}
|
||||
|
||||
|
||||
private void load(String... environment) {
|
||||
load(null, environment);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user