Browse Source

Polishing

pull/25187/head
Juergen Hoeller 6 years ago
parent
commit
bb96bd4f48
  1. 4
      spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
  2. 7
      spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleAutowireCandidateResolver.java
  3. 1
      spring-core/src/main/java/org/springframework/util/ClassUtils.java
  4. 5
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java
  5. 2
      spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java

4
spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -97,7 +97,7 @@ public final class CachedIntrospectionResults {
SpringProperties.getFlag(IGNORE_BEANINFO_PROPERTY_NAME); SpringProperties.getFlag(IGNORE_BEANINFO_PROPERTY_NAME);
/** Stores the BeanInfoFactory instances. */ /** Stores the BeanInfoFactory instances. */
private static List<BeanInfoFactory> beanInfoFactories = SpringFactoriesLoader.loadFactories( private static final List<BeanInfoFactory> beanInfoFactories = SpringFactoriesLoader.loadFactories(
BeanInfoFactory.class, CachedIntrospectionResults.class.getClassLoader()); BeanInfoFactory.class, CachedIntrospectionResults.class.getClassLoader());
private static final Log logger = LogFactory.getLog(CachedIntrospectionResults.class); private static final Log logger = LogFactory.getLog(CachedIntrospectionResults.class);

7
spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleAutowireCandidateResolver.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,6 +40,11 @@ public class SimpleAutowireCandidateResolver implements AutowireCandidateResolve
return descriptor.isRequired(); return descriptor.isRequired();
} }
@Override
public boolean hasQualifier(DependencyDescriptor descriptor) {
return false;
}
@Override @Override
@Nullable @Nullable
public Object getSuggestedValue(DependencyDescriptor descriptor) { public Object getSuggestedValue(DependencyDescriptor descriptor) {

1
spring-core/src/main/java/org/springframework/util/ClassUtils.java

@ -137,7 +137,6 @@ public abstract class ClassUtils {
primitiveTypes.addAll(primitiveWrapperTypeMap.values()); primitiveTypes.addAll(primitiveWrapperTypeMap.values());
Collections.addAll(primitiveTypes, boolean[].class, byte[].class, char[].class, Collections.addAll(primitiveTypes, boolean[].class, byte[].class, char[].class,
double[].class, float[].class, int[].class, long[].class, short[].class); double[].class, float[].class, int[].class, long[].class, short[].class);
primitiveTypes.add(void.class);
for (Class<?> primitiveType : primitiveTypes) { for (Class<?> primitiveType : primitiveTypes) {
primitiveTypeNameMap.put(primitiveType.getName(), primitiveType); primitiveTypeNameMap.put(primitiveType.getName(), primitiveType);
} }

5
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java

@ -195,7 +195,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
* through an explicit statement on the transactional connection: * through an explicit statement on the transactional connection:
* "SET TRANSACTION READ ONLY" as understood by Oracle, MySQL and Postgres. * "SET TRANSACTION READ ONLY" as understood by Oracle, MySQL and Postgres.
* <p>The exact treatment, including any SQL statement executed on the connection, * <p>The exact treatment, including any SQL statement executed on the connection,
* can be customized through through {@link #prepareTransactionalConnection}. * can be customized through {@link #prepareTransactionalConnection}.
* <p>This mode of read-only handling goes beyond the {@link Connection#setReadOnly} * <p>This mode of read-only handling goes beyond the {@link Connection#setReadOnly}
* hint that Spring applies by default. In contrast to that standard JDBC hint, * hint that Spring applies by default. In contrast to that standard JDBC hint,
* "SET TRANSACTION READ ONLY" enforces an isolation-level-like connection mode * "SET TRANSACTION READ ONLY" enforces an isolation-level-like connection mode
@ -250,9 +250,6 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
return (txObject.hasConnectionHolder() && txObject.getConnectionHolder().isTransactionActive()); return (txObject.hasConnectionHolder() && txObject.getConnectionHolder().isTransactionActive());
} }
/**
* This implementation sets the isolation level but ignores the timeout.
*/
@Override @Override
protected void doBegin(Object transaction, TransactionDefinition definition) { protected void doBegin(Object transaction, TransactionDefinition definition) {
DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction; DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction;

2
spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java

@ -398,7 +398,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
EntityManager em = txObject.getEntityManagerHolder().getEntityManager(); EntityManager em = txObject.getEntityManagerHolder().getEntityManager();
// Delegate to JpaDialect for actual transaction begin. // Delegate to JpaDialect for actual transaction begin.
final int timeoutToUse = determineTimeout(definition); int timeoutToUse = determineTimeout(definition);
Object transactionData = getJpaDialect().beginTransaction(em, Object transactionData = getJpaDialect().beginTransaction(em,
new JpaTransactionDefinition(definition, timeoutToUse, txObject.isNewEntityManagerHolder())); new JpaTransactionDefinition(definition, timeoutToUse, txObject.isNewEntityManagerHolder()));
txObject.setTransactionData(transactionData); txObject.setTransactionData(transactionData);

Loading…
Cancel
Save