Created
May 6, 2018 05:59
-
-
Save Ozsie/012a502ba8300e42add5b3f7e008a1d7 to your computer and use it in GitHub Desktop.
Hazelcast configuration bean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.ozsie.hazelcast | |
import com.hazelcast.config.Config | |
import com.hazelcast.config.EvictionPolicy | |
import com.hazelcast.config.MapConfig | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration | |
import org.springframework.boot.autoconfigure.SpringBootApplication | |
import org.springframework.boot.runApplication | |
import org.springframework.cache.annotation.EnableCaching | |
import org.springframework.context.annotation.Bean | |
@SpringBootApplication | |
@EnableAutoConfiguration | |
@EnableCaching | |
class HazelcastApplication { | |
@Bean | |
fun hazelCastConfig() = Config("instance").apply { | |
setProperty("hazelcast.phone.home.enabled", "false") | |
addMapConfig(MapConfig("map").apply { | |
evictionPolicy = EvictionPolicy.LRU | |
timeToLiveSeconds = 240 | |
}) | |
} | |
} | |
fun main(args: Array<String>) { | |
runApplication<HazelcastApplication>(*args) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment