mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
This commit is contained in:
parent
a3c63b9c34
commit
56544c8dd5
@ -69,7 +69,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
||||
@Import(DataSourceInitializedPublisher.Registrar.class)
|
||||
public abstract class JpaBaseConfiguration implements BeanFactoryAware {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
private static final Log logger = LogFactory.getLog(JpaBaseConfiguration.class);
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
@ -197,8 +197,8 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
|
||||
return ResourceUtils.extractJarFileURL(url);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.info("Could not determine persistence "
|
||||
+ "unit root location from " + source + " : " + ex);
|
||||
logger.info("Could not determine persistence " + "unit root location from "
|
||||
+ source + " : " + ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ abstract class AbstractTemplateResolverConfiguration {
|
||||
private static final Log logger = LogFactory
|
||||
.getLog(AbstractTemplateResolverConfiguration.class);
|
||||
|
||||
protected final ThymeleafProperties properties;
|
||||
private final ThymeleafProperties properties;
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@ -47,6 +47,10 @@ abstract class AbstractTemplateResolverConfiguration {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
protected final ThymeleafProperties getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkTemplateLocationExists() {
|
||||
boolean checkTemplateLocation = this.properties.isCheckTemplateLocation();
|
||||
|
@ -137,9 +137,10 @@ public class ThymeleafAutoConfiguration {
|
||||
@Override
|
||||
public SpringResourceTemplateResolver defaultTemplateResolver() {
|
||||
SpringResourceTemplateResolver resolver = super.defaultTemplateResolver();
|
||||
Method setCheckExistence = ReflectionUtils
|
||||
.findMethod(resolver.getClass(), "setCheckExistence", boolean.class);
|
||||
ReflectionUtils.invokeMethod(setCheckExistence, resolver, this.properties.isCheckTemplate());
|
||||
Method setCheckExistence = ReflectionUtils.findMethod(resolver.getClass(),
|
||||
"setCheckExistence", boolean.class);
|
||||
ReflectionUtils.invokeMethod(setCheckExistence, resolver,
|
||||
getProperties().isCheckTemplate());
|
||||
return resolver;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class ThymeleafProperties {
|
||||
}
|
||||
|
||||
public boolean isCheckTemplate() {
|
||||
return checkTemplate;
|
||||
return this.checkTemplate;
|
||||
}
|
||||
|
||||
public void setCheckTemplate(boolean checkTemplate) {
|
||||
|
@ -68,7 +68,7 @@ public class MultipartAutoConfiguration {
|
||||
@ConditionalOnMissingBean(MultipartResolver.class)
|
||||
public StandardServletMultipartResolver multipartResolver() {
|
||||
StandardServletMultipartResolver multipartResolver = new StandardServletMultipartResolver();
|
||||
multipartResolver.setResolveLazily(multipartProperties.isResolveLazily());
|
||||
multipartResolver.setResolveLazily(this.multipartProperties.isResolveLazily());
|
||||
return multipartResolver;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class MultipartProperties {
|
||||
}
|
||||
|
||||
public boolean isResolveLazily() {
|
||||
return resolveLazily;
|
||||
return this.resolveLazily;
|
||||
}
|
||||
|
||||
public void setResolveLazily(boolean resolveLazily) {
|
||||
|
@ -264,7 +264,7 @@
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>6.17</version>
|
||||
<version>7.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
@ -62,6 +62,7 @@
|
||||
<module name="com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck" />
|
||||
<module name="com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck">
|
||||
<property name="checkMethods" value="false" />
|
||||
<property name="validateOnlyOverlapping" value="false" />
|
||||
</module>
|
||||
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck" />
|
||||
|
||||
|
@ -260,10 +260,10 @@ public class RandomAccessDataFile implements RandomAccessData {
|
||||
public void close() throws IOException {
|
||||
this.available.acquireUninterruptibly(this.size);
|
||||
try {
|
||||
RandomAccessFile file = this.files.poll();
|
||||
while (file != null) {
|
||||
file.close();
|
||||
file = this.files.poll();
|
||||
RandomAccessFile pooledFile = this.files.poll();
|
||||
while (pooledFile != null) {
|
||||
pooledFile.close();
|
||||
pooledFile = this.files.poll();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -158,12 +158,12 @@ public class Handler extends URLStreamHandler {
|
||||
String path = name.substring(FILE_PROTOCOL.length());
|
||||
File file = new File(URLDecoder.decode(path, "UTF-8"));
|
||||
Map<File, JarFile> cache = rootFileCache.get();
|
||||
JarFile jarFile = (cache == null ? null : cache.get(file));
|
||||
if (jarFile == null) {
|
||||
jarFile = new JarFile(file);
|
||||
addToRootFileCache(file, jarFile);
|
||||
JarFile result = (cache == null ? null : cache.get(file));
|
||||
if (result == null) {
|
||||
result = new JarFile(file);
|
||||
addToRootFileCache(file, result);
|
||||
}
|
||||
return jarFile;
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IOException("Unable to open root Jar file '" + name + "'", ex);
|
||||
|
@ -54,14 +54,12 @@ class TomcatErrorPage {
|
||||
}
|
||||
|
||||
private Object createNativePage(ErrorPage errorPage) {
|
||||
Object nativePage = null;
|
||||
try {
|
||||
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) {
|
||||
nativePage = BeanUtils
|
||||
.instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null));
|
||||
return BeanUtils.instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null));
|
||||
}
|
||||
else if (ClassUtils.isPresent(LEGACY_ERROR_PAGE_CLASS, null)) {
|
||||
nativePage = BeanUtils
|
||||
if (ClassUtils.isPresent(LEGACY_ERROR_PAGE_CLASS, null)) {
|
||||
return BeanUtils
|
||||
.instantiate(ClassUtils.forName(LEGACY_ERROR_PAGE_CLASS, null));
|
||||
}
|
||||
}
|
||||
@ -71,7 +69,7 @@ class TomcatErrorPage {
|
||||
catch (LinkageError ex) {
|
||||
// Swallow and continue
|
||||
}
|
||||
return nativePage;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addToContext(Context context) {
|
||||
|
Loading…
Reference in New Issue
Block a user