Skip to content

Commit dcdc1e4

Browse files
committed
Add Hazelcast Java config
1 parent 6ab069f commit dcdc1e4

File tree

7 files changed

+28
-85
lines changed

7 files changed

+28
-85
lines changed

pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
<artifactId>spring-boot-starter-web</artifactId>
4040
</dependency>
4141

42-
<!-- <dependency>
43-
<groupId>com.hazelcast</groupId>
44-
<artifactId>hazelcast</artifactId>
45-
<version>${hazelcast.version}</version>
46-
</dependency>-->
4742
<dependency>
4843
<groupId>com.hazelcast</groupId>
4944
<artifactId>hazelcast-spring</artifactId>
@@ -55,11 +50,6 @@
5550
<artifactId>hazelcast-hibernate53</artifactId>
5651
<version>${hazelcast-hibernate53.version}</version>
5752
</dependency>
58-
<dependency>
59-
<groupId>com.hazelcast</groupId>
60-
<artifactId>hazelcast-client</artifactId>
61-
<version>${hazelcast-client.version}</version>
62-
</dependency>
6353

6454
<dependency>
6555
<groupId>com.h2database</groupId>
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.pj.hazelcastdemo;
22

3-
import com.hazelcast.client.HazelcastClient;
4-
import com.hazelcast.client.config.ClientConfig;
53
import org.springframework.boot.SpringApplication;
64
import org.springframework.boot.autoconfigure.SpringBootApplication;
75

@@ -10,14 +8,6 @@ public class HazelcastDemoApplication
108
{
119
public static void main(String[] args)
1210
{
13-
connectToHazelcastClient();
1411
SpringApplication.run(HazelcastDemoApplication.class, args);
1512
}
16-
17-
private static void connectToHazelcastClient()
18-
{
19-
ClientConfig clientConfig = new ClientConfig();
20-
clientConfig.getNetworkConfig().addAddress("127.0.0.1");
21-
HazelcastClient.newHazelcastClient(clientConfig);
22-
}
2313
}

src/main/java/com/pj/hazelcastdemo/config/Client.java

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
package com.pj.hazelcastdemo.config;
22

3-
import com.hazelcast.client.config.ClientConfig;
3+
import com.hazelcast.config.Config;
4+
import com.hazelcast.config.NetworkConfig;
5+
import org.springframework.context.annotation.Bean;
46
import org.springframework.context.annotation.Configuration;
57

68
@Configuration
79
public class HazelCastConfig
810
{
9-
//@Bean
10-
public ClientConfig hazelCastConfig()
11+
@Bean
12+
public Config config()
1113
{
12-
ClientConfig clientConfig = new ClientConfig();
13-
return clientConfig;
14-
//Hazelcast.newHazelcastInstance(cfg);
14+
NetworkConfig networkConfig = new NetworkConfig();
15+
networkConfig.setPublicAddress("192.168.1.157").addOutboundPort(9701);
16+
networkConfig.setPublicAddress("192.168.1.157").addOutboundPort(9702);
17+
Config config = new Config();
18+
config.setNetworkConfig(networkConfig);
19+
return config;
1520
}
1621
}

src/main/java/com/pj/hazelcastdemo/config/Member.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/main/resources/hazelcast.yml.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
hazelcast:
2+
group:
3+
name: 'hazelcastdemo'
4+
management-center:
5+
enabled: true
6+
url: 'http://localhost:8090/hazelcast-mancenter'
7+
network:
8+
port:
9+
port: 9701
10+
join:
11+
multicast:
12+
enabled: false
13+
tcp-ip:
14+
enabled: true
15+
member-list:
16+
- 192.168.1.157:9701
17+
- 192.168.1.157:9702

0 commit comments

Comments
 (0)