0

I have an error with this code, I can't find a functional solution.

@RabbitListener(queues = {"${queue.name}"}) 
public void receive(@Payload String payload) {
    try {
        Alert temp = new ObjectMapper().readValue(payload, Alert.class);
        if(temp != null) {
            int idTemp = temp.getId();
            while(verifyID(idTemp) != -1) {
                idTemp++;
            }
            temp.setId(idTemp);
            alertArray.add(temp);
        }
    } catch(IOException e) {
        
    }

}

application.properties :

spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
queue.name=test

Error :

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'queue.name' in value "${queue.name}"
Pierre
  • 1
  • Does this answer your question? [How to access a value defined in the application.properties file in Spring Boot](https://stackoverflow.com/questions/30528255/how-to-access-a-value-defined-in-the-application-properties-file-in-spring-boot) – m19v Oct 12 '22 at 09:04
  • Hi, try to remove outer curly braces from `{"${queue.name}"}` so it will look like this: `"${queue.name}"` – artiomi Oct 12 '22 at 09:05
  • 1
    @artiomi I doubt that 'll solve it, though. Pierre, are you sure that that is the properties file used? – Stultuske Oct 12 '22 at 09:23

0 Answers0