diff --git a/src/main/java/com/telpo/dipperposition/config/NettyServerConfig.java b/src/main/java/com/telpo/dipperposition/config/NettyServerConfig.java index 54fcfbb..b5f2b55 100644 --- a/src/main/java/com/telpo/dipperposition/config/NettyServerConfig.java +++ b/src/main/java/com/telpo/dipperposition/config/NettyServerConfig.java @@ -8,6 +8,8 @@ import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; +import javax.annotation.PostConstruct; + /** * @program: gateway * @description: jwt设置 @@ -33,13 +35,10 @@ public class NettyServerConfig { private String starsAsycServerPort; private static NettyServerConfig nettyServerConfig; - /** - * spring会自动从ioc容器当中根据NettyServerConfig类型找到nettyServerConfig, - * 当做参数传进来 - * - */ - @Autowired - public void setNettyServerConfig(NettyServerConfig nettyServerConfig) { - this.nettyServerConfig = nettyServerConfig; + + @PostConstruct + public void init() { + nettyServerConfig = this; } + } diff --git a/src/main/java/com/telpo/dipperposition/config/PositionConfig.java b/src/main/java/com/telpo/dipperposition/config/PositionConfig.java index 97d2d3a..f4e16a9 100644 --- a/src/main/java/com/telpo/dipperposition/config/PositionConfig.java +++ b/src/main/java/com/telpo/dipperposition/config/PositionConfig.java @@ -7,6 +7,8 @@ import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; +import javax.annotation.PostConstruct; + /** * @program: gateway * @description: jwt设置 @@ -39,12 +41,9 @@ public class PositionConfig { private static PositionConfig positionConfig; - /** - * spring会自动从ioc容器当中根据PositionConfig类型找到positionConfig,当做参数传进来 - * - */ - @Autowired - public void setPositionConfig(PositionConfig positionConfig) { - this.positionConfig = positionConfig; + + @PostConstruct + public void init() { + positionConfig = this; } }