diff --git a/src/main/java/com/loafle/commons/server/Server.java b/src/main/java/com/loafle/commons/server/Server.java index 3d4a529..b274fc7 100644 --- a/src/main/java/com/loafle/commons/server/Server.java +++ b/src/main/java/com/loafle/commons/server/Server.java @@ -6,6 +6,7 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import io.netty.bootstrap.ServerBootstrap; @@ -22,6 +23,11 @@ import io.netty.channel.nio.NioEventLoopGroup; */ public abstract class Server { private static final Logger logger = LoggerFactory.getLogger(Server.class); + public static final String CHANNEL_CLASS = "SERVER_CHANNEL_CLASS"; + public static final String CHANNEL_OPTIONS = "SERVER_CHANNEL_OPTIONS"; + public static final String CHANNEL_HANDLER = "SERVER_CHANNEL_HANDLER"; + public static final String CHANNEL_INITIALIZER = "SERVER_CHANNEL_INITIALIZER"; + public static final String SOCKET_ADDRESS = "SERVER_SOCKET_ADDRESS"; @Value("${server.netty.thread.count.boss}") protected int threadCountBoss; @@ -29,15 +35,19 @@ public abstract class Server { protected int threadCountWorker; @Autowired + @Qualifier(CHANNEL_CLASS) protected Class channelClass; - @Autowired + @Qualifier(CHANNEL_OPTIONS) protected List> channelOptions; @Autowired + @Qualifier(CHANNEL_HANDLER) protected ChannelHandler channelHandler; @Autowired + @Qualifier(CHANNEL_INITIALIZER) protected ChannelInitializer channelInitializer; @Autowired + @Qualifier(SOCKET_ADDRESS) protected SocketAddress address; public void start() throws Exception {