-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add havingValue to auto configurations (#403)
Rename SpringwolfSqsWebConfiguration to SpringwolfSqsProducerConfiguration Extract SpringwolfAmqpProducerConfiguration
- Loading branch information
Showing
12 changed files
with
82 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 2 additions & 30 deletions
32
...n/java/io/github/stavshamir/springwolf/asyncapi/amqp/SpringwolfAmqpAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,23 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.stavshamir.springwolf.asyncapi.amqp; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.github.stavshamir.springwolf.asyncapi.AsyncApiService; | ||
import io.github.stavshamir.springwolf.asyncapi.controller.SpringwolfAmqpController; | ||
import io.github.stavshamir.springwolf.configuration.AsyncApiDocketService; | ||
import io.github.stavshamir.springwolf.configuration.properties.SpringwolfAmqpConfigProperties; | ||
import io.github.stavshamir.springwolf.configuration.properties.SpringwolfConfigConstants; | ||
import io.github.stavshamir.springwolf.producer.SpringwolfAmqpProducer; | ||
import org.springframework.amqp.rabbit.core.RabbitTemplate; | ||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.lang.NonNull; | ||
|
||
import java.util.List; | ||
|
||
import static io.github.stavshamir.springwolf.configuration.properties.SpringwolfAmqpConfigConstants.SPRINGWOLF_AMQP_CONFIG_PREFIX; | ||
import static io.github.stavshamir.springwolf.configuration.properties.SpringwolfAmqpConfigConstants.SPRINGWOLF_AMQP_PLUGIN_PUBLISHING_ENABLED; | ||
|
||
/** | ||
* Autoconfiguration for the springwolf amqp plugin. | ||
*/ | ||
@AutoConfiguration | ||
@ConditionalOnProperty(name = SpringwolfConfigConstants.SPRINGWOLF_ENABLED, matchIfMissing = true) | ||
@Import({SpringwolfAmqpScannerConfiguration.class}) | ||
@ConditionalOnProperty(name = SpringwolfConfigConstants.SPRINGWOLF_ENABLED, havingValue = "true", matchIfMissing = true) | ||
@Import({SpringwolfAmqpScannerConfiguration.class, SpringwolfAmqpProducerConfiguration.class}) | ||
public class SpringwolfAmqpAutoConfiguration { | ||
|
||
@Bean | ||
public SpringwolfAmqpConfigProperties springwolfAmqpConfigProperties() { | ||
return new SpringwolfAmqpConfigProperties(); | ||
} | ||
|
||
@Bean | ||
@ConditionalOnProperty(prefix = SPRINGWOLF_AMQP_CONFIG_PREFIX, name = SPRINGWOLF_AMQP_PLUGIN_PUBLISHING_ENABLED) | ||
public SpringwolfAmqpProducer springwolfAmqpProducer( | ||
AsyncApiService asyncApiService, @NonNull List<RabbitTemplate> rabbitTemplates) { | ||
return new SpringwolfAmqpProducer(asyncApiService, rabbitTemplates); | ||
} | ||
|
||
@Bean | ||
@ConditionalOnProperty(prefix = SPRINGWOLF_AMQP_CONFIG_PREFIX, name = SPRINGWOLF_AMQP_PLUGIN_PUBLISHING_ENABLED) | ||
public SpringwolfAmqpController springwolfAmqpController( | ||
AsyncApiDocketService asyncApiDocketService, | ||
SpringwolfAmqpProducer springwolfAmqpProducer, | ||
ObjectMapper objectMapper) { | ||
return new SpringwolfAmqpController(asyncApiDocketService, springwolfAmqpProducer, objectMapper); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...va/io/github/stavshamir/springwolf/asyncapi/amqp/SpringwolfAmqpProducerConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.stavshamir.springwolf.asyncapi.amqp; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.github.stavshamir.springwolf.asyncapi.AsyncApiService; | ||
import io.github.stavshamir.springwolf.asyncapi.controller.SpringwolfAmqpController; | ||
import io.github.stavshamir.springwolf.configuration.AsyncApiDocketService; | ||
import io.github.stavshamir.springwolf.producer.SpringwolfAmqpProducer; | ||
import org.springframework.amqp.rabbit.core.RabbitTemplate; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.lang.NonNull; | ||
|
||
import java.util.List; | ||
|
||
import static io.github.stavshamir.springwolf.configuration.properties.SpringwolfAmqpConfigConstants.SPRINGWOLF_AMQP_CONFIG_PREFIX; | ||
import static io.github.stavshamir.springwolf.configuration.properties.SpringwolfAmqpConfigConstants.SPRINGWOLF_AMQP_PLUGIN_PUBLISHING_ENABLED; | ||
|
||
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnProperty( | ||
prefix = SPRINGWOLF_AMQP_CONFIG_PREFIX, | ||
name = SPRINGWOLF_AMQP_PLUGIN_PUBLISHING_ENABLED, | ||
havingValue = "true") | ||
@Import({SpringwolfAmqpScannerConfiguration.class}) | ||
public class SpringwolfAmqpProducerConfiguration { | ||
|
||
@Bean | ||
public SpringwolfAmqpProducer springwolfAmqpProducer( | ||
AsyncApiService asyncApiService, @NonNull List<RabbitTemplate> rabbitTemplates) { | ||
return new SpringwolfAmqpProducer(asyncApiService, rabbitTemplates); | ||
} | ||
|
||
@Bean | ||
public SpringwolfAmqpController springwolfAmqpController( | ||
AsyncApiDocketService asyncApiDocketService, | ||
SpringwolfAmqpProducer springwolfAmqpProducer, | ||
ObjectMapper objectMapper) { | ||
return new SpringwolfAmqpController(asyncApiDocketService, springwolfAmqpProducer, objectMapper); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters