Custom Spring boot starter

Written by kwSeo

Custom Spring boot starter

spring.factories

# resources/META-INF/spring.factories
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\
org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration

Configuration Class

@Configuration
@ConditionalOnClass(MongoClient.class)
@EnableConfigurationProperties(MongoProperties.class)
@ConditionalOnMissingBean(type = "org.springframework.data.mongodb.MongoDbFactory")
public class MongoAutoConfiguration {
    // configuration code
}
@ConfigurationProperties(prefix = ... )
class MongoProperties {
    // properties...
}

Main 클래스 이슈

spring.factories를 읽지 못하는 문제

Custom Starter Naming Comvention

Done At: Jun 3,2018
Categories: