Search in sources :

Example 1 with IgniteRepositoryFactoryBean

use of org.apache.ignite.springdata.repository.support.IgniteRepositoryFactoryBean in project ignite by apache.

the class SpringAppCfg method igniteInstance.

/**
     * Creating Apache Ignite instance bean. A bean will be passed to {@link IgniteRepositoryFactoryBean} to initialize
     * all Ignite based Spring Data repositories and connect to a cluster.
     */
@Bean
public Ignite igniteInstance() {
    IgniteConfiguration cfg = new IgniteConfiguration();
    // Setting some custom name for the node.
    cfg.setIgniteInstanceName("springDataNode");
    // Enabling peer-class loading feature.
    cfg.setPeerClassLoadingEnabled(true);
    // Defining and creating a new cache to be used by Ignite Spring Data repository.
    CacheConfiguration ccfg = new CacheConfiguration("PersonCache");
    // Setting SQL schema for the cache.
    ccfg.setIndexedTypes(Long.class, Person.class);
    cfg.setCacheConfiguration(ccfg);
    return Ignition.start(cfg);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) Bean(org.springframework.context.annotation.Bean) IgniteRepositoryFactoryBean(org.apache.ignite.springdata.repository.support.IgniteRepositoryFactoryBean)

Aggregations

CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 IgniteRepositoryFactoryBean (org.apache.ignite.springdata.repository.support.IgniteRepositoryFactoryBean)1 Bean (org.springframework.context.annotation.Bean)1