Sergey
Sergey

Reputation: 3721

Configuring Apache Ignite with Spring Boot

I am using the ignite-spring-boot-autoconfigure-ext official Ignite library for integration with my Spring Boot application. I took this example as a base: https://ignite.apache.org/docs/latest/extensions-and-integrations/spring/spring-boot#set-ignite-up-via-spring-boot-configuration The example seems pretty simple, but it shows only a small subset of Ignite configuration options. I tried to configure an IP finder and also a near cache with an eviction policy but without any success. To make matters worse incorrect configuration is usually silently ignored.

Are there more complete examples of how to use this configuration or it simply does not support more advanced configuration options?

Upvotes: 0

Views: 2195

Answers (1)

odiszapc
odiszapc

Reputation: 4109

application.yml is just a properties file, it's not a context configuration file.

application.yml helps you to set (override) properties. In the above example it overrides propertis of IgniteConfiguration class located under "ignite." in your application.yml file..

IP finder is a part ot tcpDiscoverySpi which is abstract interface so there are no setters or getters for properties to be able to override them from yml file.

You can still use XML Spring context convifiration or configure Ignite instance programatically using @ConfigurationProperties and @Value annotations :

application.yml:

ignite-ext:
  vm-ip-finder:
    addresses:
      - 192.168.0.1:47500
      - 192.168.0.1:47501
      - 192.168.0.1:47502

Usage:

@SpringBootApplication
public class AutoConfigureExample {
    @Bean
    @ConfigurationProperties(prefix = "ignite-ext.vm-ip-finder")
    public TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder() {
        return new TcpDiscoveryVmIpFinder();
    }
}

@Bean
public CommandLineRunner runner() {
    @Autowired
    TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder;
    return new CommandLineRunner() {
        ....
    }
}

Upvotes: 1

Related Questions