1、pom
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.13</artifactId>
<version>2.6.14</version>
</dependency>
2、 初始化ActorSystem 和Actor
package com.luding.hkhj.notice.config;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.luding.hkhj.notice.akka.IMActor;
import com.luding.hkhj.notice.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AkkaConfig {
@Bean
public ActorSystem actorSystem() {
//创建 actorsystem
return ActorSystem.create("imActorSystem");
}
@Bean
public ActorRef actorRef(@Autowir