Polishing

(cherry picked from commit 40efcc9)
This commit is contained in:
Juergen Hoeller
2018-06-28 14:51:31 +02:00
parent 3e64388b20
commit a631af80c1
113 changed files with 648 additions and 693 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@ import org.springframework.core.io.support.ResourcePatternUtils;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* {@link FactoryBean} that creates a Hibernate
@@ -351,8 +350,8 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
* then block until Hibernate's bootstrapping completed, if not ready by then.
* For maximum benefit, make sure to avoid early {@code SessionFactory} calls
* in init methods of related beans, even for metadata introspection purposes.
* @see LocalSessionFactoryBuilder#buildSessionFactory(AsyncTaskExecutor)
* @since 4.3
* @see LocalSessionFactoryBuilder#buildSessionFactory(AsyncTaskExecutor)
*/
public void setBootstrapExecutor(AsyncTaskExecutor bootstrapExecutor) {
this.bootstrapExecutor = bootstrapExecutor;
@@ -365,7 +364,6 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
* @since 4.3
*/
public void setMetadataSources(MetadataSources metadataSources) {
Assert.notNull(metadataSources, "MetadataSources must not be null");
this.metadataSourcesAccessed = true;
this.metadataSources = metadataSources;
}
@@ -526,7 +524,7 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
* <p>The default implementation invokes LocalSessionFactoryBuilder's buildSessionFactory.
* A custom implementation could prepare the instance in a specific way (e.g. applying
* a custom ServiceRegistry) or use a custom SessionFactoryImpl subclass.
* @param sfb LocalSessionFactoryBuilder prepared by this LocalSessionFactoryBean
* @param sfb a LocalSessionFactoryBuilder prepared by this LocalSessionFactoryBean
* @return the SessionFactory instance
* @see LocalSessionFactoryBuilder#buildSessionFactory
*/

View File

@@ -136,7 +136,9 @@ public class LocalSessionFactoryBuilder extends Configuration {
* @param metadataSources the Hibernate MetadataSources service to use (e.g. reusing an existing one)
* @since 4.3
*/
public LocalSessionFactoryBuilder(@Nullable DataSource dataSource, ResourceLoader resourceLoader, MetadataSources metadataSources) {
public LocalSessionFactoryBuilder(
@Nullable DataSource dataSource, ResourceLoader resourceLoader, MetadataSources metadataSources) {
super(metadataSources);
getProperties().put(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,9 +44,9 @@ public class SpringFlushSynchronization extends TransactionSynchronizationAdapte
@Override
public boolean equals(Object obj) {
return (obj instanceof SpringFlushSynchronization &&
this.session == ((SpringFlushSynchronization) obj).session);
public boolean equals(Object other) {
return (this == other || (other instanceof SpringFlushSynchronization &&
this.session == ((SpringFlushSynchronization) other).session));
}
@Override