001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.aop.framework; 018 019/** 020 * Delegate interface for a configured AOP proxy, allowing for the creation 021 * of actual proxy objects. 022 * 023 * <p>Out-of-the-box implementations are available for JDK dynamic proxies 024 * and for CGLIB proxies, as applied by {@link DefaultAopProxyFactory}. 025 * 026 * @author Rod Johnson 027 * @author Juergen Hoeller 028 * @see DefaultAopProxyFactory 029 */ 030public interface AopProxy { 031 032 /** 033 * Create a new proxy object. 034 * <p>Uses the AopProxy's default class loader (if necessary for proxy creation): 035 * usually, the thread context class loader. 036 * @return the new proxy object (never {@code null}) 037 * @see Thread#getContextClassLoader() 038 */ 039 Object getProxy(); 040 041 /** 042 * Create a new proxy object. 043 * <p>Uses the given class loader (if necessary for proxy creation). 044 * {@code null} will simply be passed down and thus lead to the low-level 045 * proxy facility's default, which is usually different from the default chosen 046 * by the AopProxy implementation's {@link #getProxy()} method. 047 * @param classLoader the class loader to create the proxy with 048 * (or {@code null} for the low-level proxy facility's default) 049 * @return the new proxy object (never {@code null}) 050 */ 051 Object getProxy(ClassLoader classLoader); 052 053}