小编Ore*_*kai的帖子

Spring Boot Autowired Repository null

I am creating a Netty UDP server using the spring framework. I have 3 classes and 1 interface.

UDPServer.java

package com.example.nettyUDPserver;

import java.net.InetAddress;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.stereotype.Component;

import akka.actor.ActorRef;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;


public class UDPServer {
    private int port;
    ActorRef serverActor = null;

    public UDPServer(int port) {
        this.port = port;
    }

    public void run() throws Exception {
        final NioEventLoopGroup group = new NioEventLoopGroup();
        try {
            final Bootstrap …
Run Code Online (Sandbox Code Playgroud)

java spring netty spring-boot

1
推荐指数
1
解决办法
140
查看次数

标签 统计

java ×1

netty ×1

spring ×1

spring-boot ×1