springboot+rabbitMQ+websocket+vue实现表单实时数据展示

一、创建springboot项目

1、pom.xml的依赖


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>

    <groupId>org.examplegroupId>
    <artifactId>websocket-proartifactId>
    <version>1.0-SNAPSHOTversion>

    <parent>
        <artifactId>spring-boot-starter-parentartifactId>
        <groupId>org.springframework.bootgroupId>
        <version>2.5.5version>
    parent>

    <properties>
        <maven.compiler.source>8maven.compiler.source>
        <maven.compiler.target>8maven.compiler.target>
    properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-amqpartifactId>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-websocketartifactId>
        dependency>

        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
        dependency>

        <dependency>
            <groupId>org.slf4jgroupId>
            <artifactId>slf4j-apiartifactId>
        dependency>

        
        <dependency>
            <groupId>com.alibabagroupId>
            <artifactId>fastjsonartifactId>
            <version>1.2.58version>
        dependency>
    dependencies>
project>

2、yml配置文件

server:
  port: 9527

spring:
  application:
    name: websocket-pro

  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: admin
    password: 123456

3、创建启动类

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @description: websocket练习
 * @author: wjz
 * @data: 2023-07-03 09:39
 **/
@SpringBootApplication
public class WebSocketApp {
   
    public static void main(String[] args) {
   
        SpringApplication.run(WebSocketApp.class,args);
    

你可能感兴趣的:(spring,boot,rabbitmq,websocket,vue.js)