diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index ff3652eb8a..a1d67ce551 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -140,8 +140,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { /** * Flag to indicate if the run processes should be forked. {@code fork } is - * automatically enabled if an agent or jvmArguments are specified, or if - * devtools is present. + * automatically enabled if an agent or jvmArguments are specified, or if devtools is + * present. * @since 1.2 */ @Parameter(property = "fork") @@ -167,8 +167,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { getLog().debug("skipping run as per configuration."); return; } - final String startClassName = getStartClass(); - run(startClassName); + run(getStartClass()); } /** @@ -237,8 +236,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } /** - * Log a warning indicating that fork mode has been explicitly disabled - * while some conditions are present that require to enable it. + * Log a warning indicating that fork mode has been explicitly disabled while some + * conditions are present that require to enable it. * @see #enableForkByDefault() */ protected void logDisabledFork() { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java index 812106d739..74b53f3e25 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java @@ -124,7 +124,12 @@ public class RunMojo extends AbstractRunMojo { try { URL[] urls = getClassPathUrls(); URLClassLoader classLoader = new URLClassLoader(urls); - return (classLoader.findResource(RESTARTER_CLASS_LOCATION) != null); + try { + return (classLoader.findResource(RESTARTER_CLASS_LOCATION) != null); + } + finally { + classLoader.close(); + } } catch (Exception ex) { return false; diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java index 03aec6b2c0..ca40524ded 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java @@ -25,9 +25,6 @@ import java.util.Set; import javax.sql.DataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; @@ -48,9 +45,6 @@ import org.springframework.util.ClassUtils; */ public class EntityManagerFactoryBuilder { - private static final Log logger = LogFactory - .getLog(EntityManagerFactoryBuilder.class); - private final JpaVendorAdapter jpaVendorAdapter; private final PersistenceUnitManager persistenceUnitManager; @@ -211,7 +205,8 @@ public class EntityManagerFactoryBuilder { entityManagerFactoryBean.getJpaPropertyMap().putAll(this.properties); URL rootLocation = EntityManagerFactoryBuilder.this.persistenceUnitRootLocation; if (rootLocation != null) { - entityManagerFactoryBean.setPersistenceUnitRootLocation(rootLocation.toString()); + entityManagerFactoryBean + .setPersistenceUnitRootLocation(rootLocation.toString()); } if (EntityManagerFactoryBuilder.this.callback != null) { EntityManagerFactoryBuilder.this.callback