Dharmin Patel
Dharmin Patel

Reputation: 11

How to configure polling into spring boot application?

I have configured polling into my spring boot application but, i am getting below error.

java.lang.IllegalAccessError: tried to access method org.springframework.integration.context.IntegrationProperties.()V from class org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration at org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration.integrationGlobalProperties(IntegrationAutoConfiguration.java:88)

I have added below 2 dependencies.

<dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-http</artifactId>
</dependency>

<dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-core</artifactId>
</dependency>

My code is below :

@InboundChannelAdapter(channel = "channel",
            poller = @Poller(fixedDelay = "5000"))
    public String foo() {
        System.out.println("test1");
        return "foo";
    }
    
    @ServiceActivator(inputChannel = "channel")
    public void handle(String in) {
        System.out.println("test");
    }

Upvotes: 0

Views: 272

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

Looks like you have some mess with classpath. You probably use some old Spring Integration version which is not compatible with your Spring Boot version.

Consider to remove the spring-integration.version property and fully rely on dependency management from Spring Boot.

To be more precise that org.springframework.integration.context.IntegrationProperties got public constructor in version 5.5 and respective change in the IntegrationAutoConfiguration was introduced since Spring Boot 2.5: https://github.com/spring-projects/spring-boot/pull/25377.

Both of those versions are EoL already. So, consider to upgrade your project to the latest Spring Boot version and try to rely on its dependency management: https://spring.io/projects/spring-boot#learn

Upvotes: 0

Related Questions