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

org.springframework.boot.autoconfigure.AutoConfiguration Maven / Gradle / Ivy

There is a newer version: 3.3.5
Show newest version
/*
 * Copyright 2012-2023 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.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.autoconfigure;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.annotation.ImportCandidates;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AliasFor;

/**
 * Indicates that a class provides configuration that can be automatically applied by
 * Spring Boot. Auto-configuration classes are regular
 * {@link Configuration @Configuration} with the exception that
 * {@literal Configuration#proxyBeanMethods() proxyBeanMethods} is always {@code false}.
 * They are located using {@link ImportCandidates}.
 * 

* Generally auto-configuration classes are marked as {@link Conditional @Conditional} * (most often using {@link ConditionalOnClass @ConditionalOnClass} and * {@link ConditionalOnMissingBean @ConditionalOnMissingBean} annotations). * * @author Moritz Halbritter * @see EnableAutoConfiguration * @see AutoConfigureBefore * @see AutoConfigureAfter * @see Conditional * @see ConditionalOnClass * @see ConditionalOnMissingBean * @since 2.7.0 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Configuration(proxyBeanMethods = false) @AutoConfigureBefore @AutoConfigureAfter public @interface AutoConfiguration { /** * Explicitly specify the name of the Spring bean definition associated with the * {@code @AutoConfiguration} class. If left unspecified (the common case), a bean * name will be automatically generated. *

* The custom name applies only if the {@code @AutoConfiguration} class is picked up * through component scanning or supplied directly to an * {@link AnnotationConfigApplicationContext}. If the {@code @AutoConfiguration} class * is registered as a traditional XML bean definition, the name/id of the bean element * will take precedence. * @return the explicit component name, if any (or empty String otherwise) * @see AnnotationBeanNameGenerator */ @AliasFor(annotation = Configuration.class) String value() default ""; /** * The auto-configure classes that should have not yet been applied. * @return the classes */ @AliasFor(annotation = AutoConfigureBefore.class, attribute = "value") Class[] before() default {}; /** * The names of the auto-configure classes that should have not yet been applied. * @return the class names */ @AliasFor(annotation = AutoConfigureBefore.class, attribute = "name") String[] beforeName() default {}; /** * The auto-configure classes that should have already been applied. * @return the classes */ @AliasFor(annotation = AutoConfigureAfter.class, attribute = "value") Class[] after() default {}; /** * The names of the auto-configure classes that should have already been applied. * @return the class names */ @AliasFor(annotation = AutoConfigureAfter.class, attribute = "name") String[] afterName() default {}; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy