diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java new file mode 100644 index 00000000..efe4a727 --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1LocationHandler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.LocationHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1LocationHandler extends LocationHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java new file mode 100644 index 00000000..4368a604 --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MenuHadler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.MenuHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1MenuHadler extends MenuHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java new file mode 100644 index 00000000..59ee6ae1 --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1MsgHadler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.MsgHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1MsgHadler extends MsgHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java new file mode 100644 index 00000000..cadfd1fa --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1SubscribeHadler.java @@ -0,0 +1,32 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.SubscribeHandler; + +import me.chanjar.weixin.mp.bean.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1SubscribeHadler extends SubscribeHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + + @Override + protected WxMpXmlOutMessage handleSpecial(WxMpXmlMessage wxMessage) + throws Exception { + return null; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java new file mode 100644 index 00000000..a4e3a8ed --- /dev/null +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/handler/gzh1/Gzh1UnSubscribeHadler.java @@ -0,0 +1,23 @@ +package com.github.binarywang.demo.spring.handler.gzh1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import com.github.binarywang.demo.spring.config.WxConfig; +import com.github.binarywang.demo.spring.config.WxGzh1Config; +import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class Gzh1UnSubscribeHadler extends UnsubscribeHandler { + @Autowired + private WxGzh1Config wxConfig; + + @Override + protected WxConfig getWxConfig() { + return this.wxConfig; + } + +} diff --git a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java index 74e0e566..cd809951 100644 --- a/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java +++ b/weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java @@ -10,6 +10,11 @@ import com.github.binarywang.demo.spring.handler.MenuHandler; import com.github.binarywang.demo.spring.handler.MsgHandler; import com.github.binarywang.demo.spring.handler.SubscribeHandler; import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1LocationHandler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1MenuHadler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1MsgHadler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1SubscribeHadler; +import com.github.binarywang.demo.spring.handler.gzh1.Gzh1UnSubscribeHadler; /** * @@ -19,8 +24,23 @@ import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; @Service public class Gzh1WxService extends BaseWxService { @Autowired - private WxGzh1Config wxConfig; + private WxGzh1Config wxConfig; + + @Autowired + private Gzh1LocationHandler locationHandler; + + @Autowired + private Gzh1MenuHadler menuHadler; + + @Autowired + private Gzh1MsgHadler msgHadler; + + @Autowired + private Gzh1UnSubscribeHadler unSubscribeHadler; + @Autowired + private Gzh1SubscribeHadler subscribeHadler; + @Override protected WxConfig getServerConfig() { return this.wxConfig; @@ -28,37 +48,31 @@ public class Gzh1WxService extends BaseWxService { @Override protected MenuHandler getMenuHandler() { - // TODO Auto-generated method stub - return null; + return this.menuHadler; } @Override protected SubscribeHandler getSubscribeHandler() { - // TODO Auto-generated method stub - return null; + return this.subscribeHadler; } @Override protected UnsubscribeHandler getUnsubscribeHandler() { - // TODO Auto-generated method stub - return null; + return this.unSubscribeHadler; } @Override protected AbstractHandler getLocationHandler() { - // TODO Auto-generated method stub - return null; + return this.locationHandler; } @Override protected MsgHandler getMsgHandler() { - // TODO Auto-generated method stub - return null; + return this.msgHadler; } @Override protected AbstractHandler getScanHandler() { - // TODO Auto-generated method stub return null; }