Merge branch '1.0.x'
Conflicts: spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
This commit is contained in:
commit
938609fdc0
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
|
@ -215,7 +214,7 @@ public class CrshAutoConfiguration {
|
|||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws Exception {
|
||||
public void init() {
|
||||
FS commandFileSystem = createFileSystem(
|
||||
this.properties.getCommandPathPatterns(),
|
||||
this.properties.getDisabledCommands());
|
||||
|
|
@ -234,8 +233,7 @@ public class CrshAutoConfiguration {
|
|||
start(context);
|
||||
}
|
||||
|
||||
protected FS createFileSystem(String[] pathPatterns, String[] filterPatterns)
|
||||
throws IOException, URISyntaxException {
|
||||
protected FS createFileSystem(String[] pathPatterns, String[] filterPatterns) {
|
||||
Assert.notNull(pathPatterns, "PathPatterns must not be null");
|
||||
Assert.notNull(filterPatterns, "FilterPatterns must not be null");
|
||||
FS fileSystem = new FS();
|
||||
|
|
|
|||
|
|
@ -87,10 +87,15 @@ public class BasicBatchConfigurer implements BatchConfigurer {
|
|||
}
|
||||
|
||||
@PostConstruct
|
||||
public void initialize() throws Exception {
|
||||
this.transactionManager = createTransactionManager();
|
||||
this.jobRepository = createJobRepository();
|
||||
this.jobLauncher = createJobLauncher();
|
||||
public void initialize() {
|
||||
try {
|
||||
this.transactionManager = createTransactionManager();
|
||||
this.jobRepository = createJobRepository();
|
||||
this.jobLauncher = createJobLauncher();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException("Unable to initialize Spring Batch", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private JobLauncher createJobLauncher() throws Exception {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.springframework.core.env.Environment;
|
|||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
import org.springframework.jdbc.support.MetaDataAccessException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
|
|
@ -58,10 +59,9 @@ public class BatchDatabaseInitializer implements EnvironmentAware {
|
|||
}
|
||||
|
||||
@PostConstruct
|
||||
protected void initialize() throws Exception {
|
||||
protected void initialize() {
|
||||
if (this.enabled) {
|
||||
String platform = DatabaseType.fromMetaData(this.dataSource).toString()
|
||||
.toLowerCase();
|
||||
String platform = getDatabaseType();
|
||||
if ("hsql".equals(platform)) {
|
||||
platform = "hsqldb";
|
||||
}
|
||||
|
|
@ -78,4 +78,13 @@ public class BatchDatabaseInitializer implements EnvironmentAware {
|
|||
}
|
||||
}
|
||||
|
||||
private String getDatabaseType() {
|
||||
try {
|
||||
return DatabaseType.fromMetaData(this.dataSource).toString().toLowerCase();
|
||||
}
|
||||
catch (MetaDataAccessException ex) {
|
||||
throw new IllegalStateException("Unable to detect database type", ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.jdbc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -80,7 +81,7 @@ public class DataSourceAutoConfiguration {
|
|||
private DataSourceProperties properties;
|
||||
|
||||
@PostConstruct
|
||||
protected void initialize() throws Exception {
|
||||
protected void initialize() {
|
||||
boolean initialize = this.properties.isInitialize();
|
||||
if (this.dataSource == null || !initialize) {
|
||||
logger.debug("No DataSource found so not initializing");
|
||||
|
|
@ -96,11 +97,7 @@ public class DataSourceAutoConfiguration {
|
|||
schema += "classpath*:data.sql";
|
||||
}
|
||||
|
||||
List<Resource> resources = new ArrayList<Resource>();
|
||||
for (String schemaLocation : StringUtils.commaDelimitedListToStringArray(schema)) {
|
||||
resources.addAll(Arrays.asList(this.applicationContext
|
||||
.getResources(schemaLocation)));
|
||||
}
|
||||
List<Resource> resources = getSchemaResources(schema);
|
||||
|
||||
boolean continueOnError = this.properties.isContinueOnError();
|
||||
boolean exists = false;
|
||||
|
|
@ -119,6 +116,21 @@ public class DataSourceAutoConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
private List<Resource> getSchemaResources(String schema) {
|
||||
List<Resource> resources = new ArrayList<Resource>();
|
||||
for (String schemaLocation : StringUtils.commaDelimitedListToStringArray(schema)) {
|
||||
try {
|
||||
resources.addAll(Arrays.asList(this.applicationContext
|
||||
.getResources(schemaLocation)));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException("Unable to load resource from "
|
||||
+ schemaLocation, ex);
|
||||
}
|
||||
}
|
||||
return resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the {@code dataSource} being used by Spring was created from
|
||||
* {@link EmbeddedDataSourceConfiguration}.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import com.mongodb.MongoClientOptions;
|
|||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Mongo.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Oliver Gierke
|
||||
* @author Phillip Webb
|
||||
|
|
@ -52,7 +52,7 @@ public class MongoAutoConfiguration {
|
|||
private Mongo mongo;
|
||||
|
||||
@PreDestroy
|
||||
public void close() throws UnknownHostException {
|
||||
public void close() {
|
||||
if (this.mongo != null) {
|
||||
this.mongo.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue