Skip to content
This repository has been 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
lhmoraes opened this issue Mar 20, 2021 · 3 comments · Fixed by #65, #66 or #67
Closed

A component required a bean named 'test1' that could not be found #59

lhmoraes opened this issue Mar 20, 2021 · 3 comments · Fixed by #65, #66 or #67
Assignees
Labels
question Further information is requested v2.2.4 v2.3.5 v2.4.0

Comments

@lhmoraes
Copy link

lhmoraes commented Mar 20, 2021

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

@rwanderc rwanderc self-assigned this Mar 27, 2021
@rwanderc
Copy link
Contributor

rwanderc commented Mar 27, 2021

Hi @lhmoraes. thank you for opening the issue.
This is happening because you are using MultiRabbit 2.3.1 with SpringBoot 2.4.x (and the underlying version of spring-amqp).
This is probably fixed when MultiRabbit 2.4.0 or 2.4.1 is released.
You can subscribe to the issue GH-35 to be aware of updates on this.

@rwanderc rwanderc added the question Further information is requested label Mar 27, 2021
@lhmoraes
Copy link
Author

Hi @rwanderc I will monitoring the new releases. Thanks again for the project

@ocristian
Copy link
Collaborator

Hi @lhmoraes, we've fixed this issue on releases v2.2.4, v2.3.5 and v2.4.0(Introduces compatibility with Spring Boot 2.4.0).
Please take a look and let us know you need any help.
Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.