Polishing
This commit is contained in:
parent
6697461003
commit
00bda65848
|
@ -414,7 +414,6 @@ class AspectJExpressionPointcutTests {
|
|||
assertThat(ajexp.matches(BeanA.class.getMethod("getAge"), proxy.getClass())).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testNotAnnotationOnCglibProxyMethod() throws Exception {
|
||||
String expression = "!@annotation(test.annotation.transaction.Tx)";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
@ -121,7 +121,7 @@ public interface SmartLifecycle extends Lifecycle, Phased {
|
|||
/**
|
||||
* Return the phase that this lifecycle object is supposed to run in.
|
||||
* <p>The default implementation returns {@link #DEFAULT_PHASE} in order to
|
||||
* let {@code stop()} callbacks execute after regular {@code Lifecycle}
|
||||
* let {@code stop()} callbacks execute before regular {@code Lifecycle}
|
||||
* implementations.
|
||||
* @see #isAutoStartup()
|
||||
* @see #start()
|
||||
|
|
|
@ -204,8 +204,9 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
|||
/**
|
||||
* Set the {@link ManagedClassNameFilter} to apply on entity classes discovered
|
||||
* using {@linkplain #setPackagesToScan(String...) classpath scanning}.
|
||||
* @param managedClassNameFilter the predicate to filter entity classes
|
||||
* @param managedClassNameFilter a predicate to filter entity classes
|
||||
* @since 6.1.4
|
||||
* @see DefaultPersistenceUnitManager#setManagedClassNameFilter
|
||||
*/
|
||||
public void setManagedClassNameFilter(ManagedClassNameFilter managedClassNameFilter) {
|
||||
this.internalPersistenceUnitManager.setManagedClassNameFilter(managedClassNameFilter);
|
||||
|
|
|
@ -238,7 +238,7 @@ public class DefaultPersistenceUnitManager
|
|||
/**
|
||||
* Set the {@link ManagedClassNameFilter} to apply on entity classes discovered
|
||||
* using {@linkplain #setPackagesToScan(String...) classpath scanning}.
|
||||
* @param managedClassNameFilter the predicate to filter entity classes
|
||||
* @param managedClassNameFilter a predicate to filter entity classes
|
||||
* @since 6.1.4
|
||||
*/
|
||||
public void setManagedClassNameFilter(ManagedClassNameFilter managedClassNameFilter) {
|
||||
|
|
|
@ -22,12 +22,13 @@ package org.springframework.orm.jpa.persistenceunit;
|
|||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.1.4
|
||||
* @see DefaultPersistenceUnitManager#setManagedClassNameFilter
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ManagedClassNameFilter {
|
||||
|
||||
/**
|
||||
* Test if the given clas name matches the filter.
|
||||
* Test if the given class name matches the filter.
|
||||
* @param className the fully qualified class name of the persistent type to test
|
||||
* @return {@code true} if the class name matches
|
||||
*/
|
||||
|
|
|
@ -83,17 +83,26 @@ public final class PersistenceManagedTypesScanner {
|
|||
private final ManagedClassNameFilter managedClassNameFilter;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@code PersistenceManagedTypesScanner} for the given resource loader.
|
||||
* @param resourceLoader the {@code ResourceLoader} to use
|
||||
*/
|
||||
public PersistenceManagedTypesScanner(ResourceLoader resourceLoader) {
|
||||
this(resourceLoader, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@code PersistenceManagedTypesScanner} for the given resource loader.
|
||||
* @param resourceLoader the {@code ResourceLoader} to use
|
||||
* @param managedClassNameFilter an optional predicate to filter entity classes
|
||||
* @since 6.1.4
|
||||
*/
|
||||
public PersistenceManagedTypesScanner(ResourceLoader resourceLoader,
|
||||
@Nullable ManagedClassNameFilter managedClassNameFilter) {
|
||||
|
||||
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
|
||||
this.componentsIndex = CandidateComponentsIndexLoader.loadIndex(resourceLoader.getClassLoader());
|
||||
this.managedClassNameFilter = (managedClassNameFilter != null ? managedClassNameFilter
|
||||
: className -> true);
|
||||
}
|
||||
|
||||
public PersistenceManagedTypesScanner(ResourceLoader resourceLoader) {
|
||||
this(resourceLoader, null);
|
||||
this.managedClassNameFilter = (managedClassNameFilter != null ? managedClassNameFilter : className -> true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,13 +135,12 @@ public final class PersistenceManagedTypesScanner {
|
|||
String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +
|
||||
ClassUtils.convertClassNameToResourcePath(pkg) + CLASS_RESOURCE_PATTERN;
|
||||
Resource[] resources = this.resourcePatternResolver.getResources(pattern);
|
||||
MetadataReaderFactory readerFactory = new CachingMetadataReaderFactory(this.resourcePatternResolver);
|
||||
MetadataReaderFactory factory = new CachingMetadataReaderFactory(this.resourcePatternResolver);
|
||||
for (Resource resource : resources) {
|
||||
try {
|
||||
MetadataReader reader = readerFactory.getMetadataReader(resource);
|
||||
MetadataReader reader = factory.getMetadataReader(resource);
|
||||
String className = reader.getClassMetadata().getClassName();
|
||||
if (matchesEntityTypeFilter(reader, readerFactory)
|
||||
&& this.managedClassNameFilter.matches(className)) {
|
||||
if (matchesEntityTypeFilter(reader, factory) && this.managedClassNameFilter.matches(className)) {
|
||||
scanResult.managedClassNames.add(className);
|
||||
if (scanResult.persistenceUnitRootUrl == null) {
|
||||
URL url = resource.getURL();
|
||||
|
@ -168,9 +176,9 @@ public final class PersistenceManagedTypesScanner {
|
|||
* Check whether any of the configured entity type filters matches
|
||||
* the current class descriptor contained in the metadata reader.
|
||||
*/
|
||||
private boolean matchesEntityTypeFilter(MetadataReader reader, MetadataReaderFactory readerFactory) throws IOException {
|
||||
private boolean matchesEntityTypeFilter(MetadataReader reader, MetadataReaderFactory factory) throws IOException {
|
||||
for (TypeFilter filter : entityTypeFilters) {
|
||||
if (filter.match(reader, readerFactory)) {
|
||||
if (filter.match(reader, factory)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
@ -36,18 +36,21 @@ import org.springframework.lang.Nullable;
|
|||
*/
|
||||
public class TransactionContext {
|
||||
|
||||
private final @Nullable TransactionContext parent;
|
||||
@Nullable
|
||||
private final TransactionContext parent;
|
||||
|
||||
private final Map<Object, Object> resources = new LinkedHashMap<>();
|
||||
|
||||
@Nullable
|
||||
private Set<TransactionSynchronization> synchronizations;
|
||||
|
||||
private volatile @Nullable String currentTransactionName;
|
||||
@Nullable
|
||||
private volatile String currentTransactionName;
|
||||
|
||||
private volatile boolean currentTransactionReadOnly;
|
||||
|
||||
private volatile @Nullable Integer currentTransactionIsolationLevel;
|
||||
@Nullable
|
||||
private volatile Integer currentTransactionIsolationLevel;
|
||||
|
||||
private volatile boolean actualTransactionActive;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
@ -39,7 +39,7 @@ import org.springframework.util.Assert;
|
|||
* to defer the invocation of the write function, until we know if the source
|
||||
* publisher will begin publishing without an error. If the first emission is
|
||||
* an error, the write function is bypassed, and the error is sent directly
|
||||
* through the result publisher. Otherwise the write function is invoked.
|
||||
* through the result publisher. Otherwise, the write function is invoked.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Stephane Maldini
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
@ -39,7 +39,6 @@ import org.springframework.core.io.buffer.DataBufferFactory;
|
|||
*/
|
||||
public class JettyHttpHandlerAdapter extends ServletHttpHandlerAdapter {
|
||||
|
||||
|
||||
public JettyHttpHandlerAdapter(HttpHandler httpHandler) {
|
||||
super(httpHandler);
|
||||
}
|
||||
|
|
|
@ -565,6 +565,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
|||
/**
|
||||
* A registry that maintains all mappings to handler methods, exposing methods
|
||||
* to perform lookups and providing concurrent access.
|
||||
*
|
||||
* <p>Package-private for testing purposes.
|
||||
*/
|
||||
class MappingRegistry {
|
||||
|
|
Loading…
Reference in New Issue