"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java" between
spring-boot-2.7.3.tar.gz and spring-boot-2.7.4.tar.gz

About: Spring Boot helps to create Spring-powered, production-grade applications and services.

H2ConsoleAutoConfiguration.java  (spring-boot-2.7.3):H2ConsoleAutoConfiguration.java  (spring-boot-2.7.4)
skipping to change at line 68 skipping to change at line 68
private static final Log logger = LogFactory.getLog(H2ConsoleAutoConfigur ation.class); private static final Log logger = LogFactory.getLog(H2ConsoleAutoConfigur ation.class);
@Bean @Bean
public ServletRegistrationBean<WebServlet> h2Console(H2ConsoleProperties properties, public ServletRegistrationBean<WebServlet> h2Console(H2ConsoleProperties properties,
ObjectProvider<DataSource> dataSource) { ObjectProvider<DataSource> dataSource) {
String path = properties.getPath(); String path = properties.getPath();
String urlMapping = path + (path.endsWith("/") ? "*" : "/*"); String urlMapping = path + (path.endsWith("/") ? "*" : "/*");
ServletRegistrationBean<WebServlet> registration = new ServletReg istrationBean<>(new WebServlet(), urlMapping); ServletRegistrationBean<WebServlet> registration = new ServletReg istrationBean<>(new WebServlet(), urlMapping);
configureH2ConsoleSettings(registration, properties.getSettings() ); configureH2ConsoleSettings(registration, properties.getSettings() );
if (logger.isInfoEnabled()) { if (logger.isInfoEnabled()) {
logDataSources(dataSource, path); withThreadContextClassLoader(getClass().getClassLoader(), () -> logDataSources(dataSource, path));
} }
return registration; return registration;
} }
private void withThreadContextClassLoader(ClassLoader classLoader, Runnab
le action) {
ClassLoader previous = Thread.currentThread().getContextClassLoad
er();
try {
Thread.currentThread().setContextClassLoader(classLoader)
;
action.run();
}
finally {
Thread.currentThread().setContextClassLoader(previous);
}
}
private void logDataSources(ObjectProvider<DataSource> dataSource, String path) { private void logDataSources(ObjectProvider<DataSource> dataSource, String path) {
List<String> urls = dataSource.orderedStream().map((available) -> { List<String> urls = dataSource.orderedStream().map((available) -> {
try (Connection connection = available.getConnection()) { try (Connection connection = available.getConnection()) {
return "'" + connection.getMetaData().getURL() + "'"; return "'" + connection.getMetaData().getURL() + "'";
} }
catch (Exception ex) { catch (Exception ex) {
return null; return null;
} }
}).filter(Objects::nonNull).collect(Collectors.toList()); }).filter(Objects::nonNull).collect(Collectors.toList());
if (!urls.isEmpty()) { if (!urls.isEmpty()) {
 End of changes. 2 change blocks. 
1 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)