====== SpringBoot Auto Configuration ======
* [[springframework:springboot|SpringBoot]]의 자동화된 설정을 다룬다.
* [[https://github.com/spring-projects/spring-boot/tree/master/spring-boot-project/spring-boot-autoconfigure|spring-boot-autoconfigure]] 모듈의 소스를 참조하면 자동 설정 원리를 파악할 수 있다.
* [[https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories|spring.factories]]에 자동설정 Configuration 목록 있음.
===== Auto Configuration exclude =====
* [[https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-auto-configuration.html|16. Auto-configuration]]
* [[https://tech.asimio.net/2017/10/17/Disabling-Redis-Autoconfiguration-in-Spring-Boot-applications.html|Disabling Redis Auto-configuration in Spring Boot applications]]
* [[http://wonwoo.ml/index.php/post/1599|Spring boot configuration]]
* ''spring.autoconfigure.exclude'' 프라퍼티를 yaml 에 지정해서 불필요한 Auto Configuration loading을 막을 수 있다.
spring:
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
- org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration
* 혹은, ''@SpringBootApplication'' 애노테이션에서도 가능하다.
@SpringBootApplication(
exclude = { RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class }
)
// 문자열로. FQCN 이 아니어도 되는지 여부 확인 필요.
@SpringBootApplication(
excludeName = { "RedisAutoConfiguration", "RedisRepositoriesAutoConfiguration" }
)
===== @AutoConfigurationAfter, @AutoConfigurationBefore =====
* 특정 Auto Configuration 실행 전후에 할 설정임을 마킹.
@Configuration
@AutoConfigureBefore(JacksonAutoConfiguration.class)
public class SpringAutoConfiguration {
}
===== Custom Starter =====
* [[http://www.baeldung.com/spring-boot-custom-starter|Creating a Custom Starter with Spring Boot]]
* [[https://www.javadevjournal.com/spring-boot/spring-boot-custom-starter/|Custom Starter with Spring Boot | Java Development Journal]]
===== 참조 =====
* [[https://www.baeldung.com/spring-data-disable-auto-config|Disable Spring Data Auto Configuration | Baeldung]]