refactor: 리펙토링 진행중 의존성 gradle은 얇게 유지, 각 모듈에서 처리하고 있는 부분에 대해서 리펙토링
This commit is contained in:
+23
@@ -48,6 +48,12 @@ public class MessagingProviderSelection {
|
||||
"kafka", "dev.caskeleton.messaging.autoconfigure.KafkaMessagingAutoConfiguration",
|
||||
"rabbit", "dev.caskeleton.messaging.autoconfigure.RabbitMessagingAutoConfiguration");
|
||||
|
||||
/** Broker id to the starter a deployment adds to its build to obtain that transport. */
|
||||
static final Map<String, String> PROVIDER_STARTERS =
|
||||
Map.of(
|
||||
"kafka", "messaging-spring-boot-starter-kafka",
|
||||
"rabbit", "messaging-spring-boot-starter-rabbit");
|
||||
|
||||
/**
|
||||
* Broker ids that ship without a {@code MessagingTransport}, and why.
|
||||
*
|
||||
@@ -118,6 +124,23 @@ public class MessagingProviderSelection {
|
||||
+ clientClass
|
||||
+ " on the classpath; the deployment selected a transport it did not ship");
|
||||
}
|
||||
// The client library and the broker starter are two different build decisions, and only the
|
||||
// second one carries the configuration that assembles the transport. A deployment can hold the
|
||||
// Kafka client transitively and still not ship the Kafka starter — this core starter is
|
||||
// broker-neutral on purpose — and until this check existed that combination reached Spring's
|
||||
// import machinery, which reported a missing .class file rather than a missing capability.
|
||||
String providerConfiguration = PROVIDER_CONFIGURATIONS.get(broker);
|
||||
if (!ClassUtils.isPresent(
|
||||
providerConfiguration, MessagingProviderSelection.class.getClassLoader())) {
|
||||
throw new IllegalStateException(
|
||||
MessagingSettings.PREFIX
|
||||
+ ".broker="
|
||||
+ broker
|
||||
+ " needs the "
|
||||
+ PROVIDER_STARTERS.get(broker)
|
||||
+ " module on the classpath; this core starter is broker-neutral and the deployment"
|
||||
+ " did not compose the transport it selected");
|
||||
}
|
||||
String unfinished = BROKERS_WITHOUT_A_TRANSPORT.get(broker);
|
||||
if (unfinished != null) {
|
||||
throw new IllegalStateException(
|
||||
|
||||
Reference in New Issue
Block a user