<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-erlang</artifactId> <version>1.0.0</version> </dependency> properties spring.erlang.node.name=my-node@localhost spring.erlang.cookie=my-cookie spring.erlang.node.cookie=my-node-cookie import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.erlang.core.ErlangOperations; @SpringBootApplication public class ErlangApplication { @Autowired private ErlangOperations erlangOperations; public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(ErlangApplication.class, args); ErlangApplication application = context.getBean(ErlangApplication.class); application.run(); } public void run() { erlangOperations.send("my-erlang-node", "Hello from Java!"); String message = erlangOperations.receive(); System.out.println("Received message from Erlang: " + message); } } $ mvn spring-boot:run


上一篇:
下一篇:
切换中文