I am using springboot + ignite. it's very simple.
you can reproduce this issue with below code

Bean definition

-----------------------------------------

    @Bean
    public CommandLineRunner commandLineRunner(@Autowired ApplicationContext
context) {
        return args -> {
            logger.info("Start ignite database ......");
            logger.info("Region name is: {}", regionName);
            IgniteSpringBean igniteSpringBean =
context.getBean("igniteSpringBean", IgniteSpringBean.class);

            igniteSpringBean.active(true);
            logger.info("Init ignite database ......");

            CacheConfiguration cacheCfg = cacheCfg();
            logger.info("Cache name is {}", cacheCfg.getName());
            cacheCfg.setIndexedTypes(String.class, Article.class,
ArticleAffKey.class, Comment.class, CommentAffKey.class, Reply.class);
            igniteSpringBean.getOrCreateCache(cacheCfg);
        };
    }

    @Bean
    public CacheConfiguration cacheCfg() {
        CacheConfiguration cacheCfg = new CacheConfiguration<>(IgDef.DOCS);
        cacheCfg.setBackups(1);
       
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
        if
(!Arrays.asList(environment.getActiveProfiles()).contains("test")) {
            cacheCfg.setDataRegionName(regionName);
        }
        return cacheCfg;
    }


------------------------------

ignite.xml

---------------------

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:util="http://www.springframework.org/schema/util";
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           
http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/util
                           
http://www.springframework.org/schema/util/spring-util.xsd";>

    <bean id="igniteSpringBean" class="org.apache.ignite.IgniteSpringBean">
        <property name="configuration" ref="igcfg"/>
    </bean>

    <bean id="igcfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="clientMode" value="${ignite.clientMode}"/>
        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses"
value="#{'${ignite.TcpDiscoverySpi.addresses}'.split(',')}"/>
                    </bean>
                </property>
                
            </bean>
        </property>



        <property name="dataStorageConfiguration">
            <bean
class="org.apache.ignite.configuration.DataStorageConfiguration">

                <property name="storagePath"
value="${ignite.storage.storagePath}"/>
                <property name="walPath" value="${ignite.storage.walPath}"/>
                <property name="walArchivePath"
value="${ignite.storage.walArchivePath}"/>

                <property name="dataRegionConfigurations">
                    <list>
                        <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
                            <property name="name" value="r20g"/>
                            <property name="initialSize"
value='#{${ignite.storage.dataRegion.region_uat.initialSize}}'/>
                            <property name="maxSize"
value='#{${ignite.storage.dataRegion.region_uat.maxSize}}'/>
                            <property name="persistenceEnabled"
value="true"/>
                        </bean>
                        <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
                            <property name="name" value="r5g"/>
                            <property name="initialSize"
value='#{${ignite.storage.dataRegion.region_sc.initialSize}}'/>
                            <property name="maxSize"
value='#{${ignite.storage.dataRegion.region_sc.maxSize}}'/>
                            <property name="persistenceEnabled"
value="true"/>
                        </bean>
                    </list>
                </property>
                <property name="defaultDataRegionConfiguration">
                    <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="name" value="Default_Region"/>
                        
                        <property name="maxSize" value="#{40L * 1024 *
1024}"/>
                        <property name="persistenceEnabled" value="true"/>
                    </bean>
                </property>
            </bean>
        </property>
        
    </bean>

</beans>





--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/

Reply via email to