All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jodd.petite.proxetta.ProxettaAwarePetiteContainer Maven / Gradle / Ivy

Go to download

Jodd Petite is slick and lightweight DI container that uses annotations and supports sufficient most of features offered by other containers.

There is a newer version: 6.0.2
Show newest version
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.petite.proxetta;

import jodd.petite.BeanDefinition;
import jodd.petite.PetiteContainer;
import jodd.petite.WiringMode;
import jodd.petite.scope.Scope;
import jodd.proxetta.impl.ProxyProxettaBuilder;
import jodd.proxetta.impl.ProxyProxetta;

/**
 * Proxetta-aware Petite container that applies proxies on bean registration.
 */
public class ProxettaAwarePetiteContainer extends PetiteContainer {

	protected final ProxyProxetta proxetta;

	public ProxettaAwarePetiteContainer() {
		this(null);
	}
	public ProxettaAwarePetiteContainer(ProxyProxetta proxetta) {
		this.proxetta = proxetta;
	}

	/**
	 * Applies proxetta on bean class before bean registration.
	 */
	@Override
	protected BeanDefinition createBeanDefinitionForRegistration(String name, Class type, Scope scope, WiringMode wiringMode) {
		if (proxetta != null) {
			ProxyProxettaBuilder builder = proxetta.builder();

			builder.setTarget(type);

			type = builder.define();
		}

		return super.createBeanDefinitionForRegistration(name, type, scope, wiringMode);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy