This repository was archived by the owner on Feb 21, 2024. It is now read-only.
This repository was archived by the owner on Feb 21, 2024. It is now read-only.
A component required a bean named 'test1' that could not be found #59
Closed
Description
Spring Boot: 2.4.4
Spring Starter AMQP: 2.4.4
Kotlin: 1.4.31
com.free-now.multirabbit:spring-multirabbit:2.3.1
application.properties
spring.multirabbitmq.enabled=true
spring.multirabbitmq.defaultConnection=test1
# Connection to customer: test1
spring.multirabbitmq.connections.test1.host=broker1
spring.multirabbitmq.connections.test1.port=5672
spring.multirabbitmq.connections.test1.username=user1
spring.multirabbitmq.connections.test1.password=pass1
spring.multirabbitmq.connections.test1.virtual-host=/vhost
# Connection to customer: test2
spring.multirabbitmq.connections.test2.host=broker2
spring.multirabbitmq.connections.test2.port=5672
spring.multirabbitmq.connections.test2.username=user1
spring.multirabbitmq.connections.test2.password=pass1
spring.multirabbitmq.connections.test2.virtual-host=/vhost
Main Class:
@EnableRabbit
@SpringBootApplication(scanBasePackages = ["com.example"])
class MainApplication
Listener Class:
@Component
class TestListener {
@RabbitListener(containerFactory = "test1",
bindings = [(QueueBinding(Queue("queue1"), exchange = Exchange("exchange1")))])
fun listenQueue(message: Any, channel: Channel, @Header(AmqpHeaders.DELIVERY_TAG) tag: Long) {
info("Listener Test1: $message")
}
@RabbitListener(containerFactory = "test2",
bindings = [(QueueBinding(Queue("queue2"), exchange = Exchange("exchange2")))])
fun listenQueue(message: Any, channel: Channel, @Header(AmqpHeaders.DELIVERY_TAG) tag: Long) {
info("Listener Test1: $message")
}
}
Exception:
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean named 'test1' that could not be found.
Action:
Consider defining a bean named 'test1' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:51331', transport: 'socket'
Process finished with exit code 1
Please, just let me know if you need more information.
Thanks