fastbootweixin / fastbootweixin Goto Github PK
View Code? Open in Web Editor NEW基于Spring Boot的注解驱动式公众号极速开发框架,用注解重新定义公众号开发
Home Page: https://gitee.com/kingshine/FastBootWeixin
License: Apache License 2.0
基于Spring Boot的注解驱动式公众号极速开发框架,用注解重新定义公众号开发
Home Page: https://gitee.com/kingshine/FastBootWeixin
License: Apache License 2.0
亲可以用到生产中了吗?
Method threw 'java.lang.NullPointerException' exception. Cannot evaluate com.sun.proxy.$Proxy66.toString()
@Configuration
@ConditionalOnClass(RestTemplate.class)
public class WxInvokerConfiguration {
private static final Log logger = LogFactory.getLog(MethodHandles.lookup().lookupClass());
private final WxProperties wxProperties;
private final ObjectProvider<HttpMessageConverters> messageConverters;
public WxInvokerConfiguration(
WxProperties wxProperties,
ObjectProvider<HttpMessageConverters> messageConverters) {
this.wxProperties = wxProperties;
this.messageConverters = messageConverters;
}
@Bean
public WxContextUtils wxApplicationContextUtils() {
return new WxContextUtils();
}
/**
* 是否有必要模仿Spring不提供RestTemplate,只提供RestTemplateBuilder
*
* @return dummy
*/
@Bean(name = WxBeans.WX_API_INVOKER_NAME)
public WxApiInvoker wxApiInvoker() {
RestTemplateBuilder builder = new RestTemplateBuilder();
builder = builder.requestFactory(new WxApiHttpRequestFactory(wxProperties))
.errorHandler(new WxResponseErrorHandler());
HttpMessageConverters converters = this.messageConverters.getIfUnique();
List<HttpMessageConverter<?>> converterList = new ArrayList<>();
// 加入默认转换
converterList.add(new WxHttpInputMessageConverter());
if (converters != null) {
converterList.addAll(converters.getConverters());
builder = builder.messageConverters(Collections.unmodifiableList(converterList));
}
return new WxApiInvoker(builder.build());
}
@Bean
public WxApiExecutor wxApiExecutor(WxAccessTokenManager wxAccessTokenManager) {
return new WxApiExecutor(wxApiInvoker(), wxAccessTokenManager);
}
@Bean
public WxInvokerProxyFactory<WxApiInvokeSpi> wxInvokerProxyFactory(WxApiExecutor wxApiExecutor) {
return new WxInvokerProxyFactory(WxApiInvokeSpi.class, wxProperties, wxApiExecutor);
}
@Bean
@ConditionalOnMissingBean
public WxUserProvider userProvider(WxUserManager wxUserManager) {
return new DefaultWxUserProvider(wxUserManager);
}
@Bean
public WxUserManager wxUserManager(@Lazy WxTokenServer wxTokenServer, @Lazy WxApiInvokeSpi wxApiInvokeSpi) {
return new WxUserManager(wxTokenServer, wxApiInvokeSpi);
}
private HttpMessageConverters getDefaultWxMessageConverters() {
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
stringConverter.setWriteAcceptCharset(false);
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
Jaxb2RootElementHttpMessageConverter xmlConverter = new Jaxb2RootElementHttpMessageConverter();
AllEncompassingFormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter();
ResourceHttpMessageConverter resourceConverter = new ResourceHttpMessageConverter();
HttpMessageConverters wxMessageConverters = new HttpMessageConverters(stringConverter, jsonConverter, xmlConverter, formConverter, resourceConverter);
return wxMessageConverters;
}
}
WxInvokerConfiguration的代码, 只看到了一个工厂对象。
原因是WebMvcMetricsFilter监控过滤器会先尝试拿一次handler,并做记录。
那么获取handler的逻辑会执行两次,导致第二次执行时body解析失败。
wxbutton里的type中没有发现跳转小程序的按钮类型,官方文档有按钮类型,如果能填进jar包中不需要后续再开发会方便很多。
基于菜单的动态配置与事件绑定
启动时从服务器缓存菜单,当菜单请求过来的时候,通过缓存的菜单key拿到具体的菜单属性,再根据菜单属性与WxButtonMapping注解做匹配找到处理逻辑,这种方式似乎更优
wx.config({
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: '', // 必填,公众号的唯一标识
timestamp: , // 必填,生成签名的时间戳
nonceStr: '', // 必填,生成签名的随机串
signature: '',// 必填,签名
jsApiList: [] // 必填,需要使用的JS接口列表
});
对接JS需要后台传给前端appId,timestamp,nonceStr,signature。
生成签名还需要后台额外两个步骤的请求,有点麻烦。
迫切希望能对接JS功能
经常遇到这个问题,不知道是不是因为和其他框架集成之后冲突了
集成的框架有:SpringBoot、SpringSecurity、SpringMVC、SpringDataJPA
本次错误出现在发送微信消息之后,经断点调试,在return WxMessage时会进坑,怀疑是使用微信接口和Security框架冲突了,具体情况还在检查中……
Java代码如下:
@RequestMapping(value = "/sendByParam", method = RequestMethod.POST)
@ResponseBody
public WxMessage sendMsgByParam(@RequestParam("content") String content,
@RequestParam(value = "academy", required = false)String academy,
@RequestParam(value = "major", required = false)String major,
@RequestParam(value = "gradeClass", required = false)Integer gradeClass,
@RequestParam(value = "direction", required = false)String direction ) {
try{
System.out.println("sendMsgByParam:"+content);
System.out.println("Param: {academy: "+academy+", major: "+major+", gradeClass: "+gradeClass+", direction: "+direction+"}");
List<Student> studentList = studentService.findByMajorAndGradeClassAndOpenIDNotNull(major, gradeClass);
System.out.println("studentList: "+studentList);
List<String>openIdList = new ArrayList<>();
for( Student student : studentList ){
String openID = student.getOpenID();
if( openID != null ){
openIdList.add(openID);
}
}
return WxMessage.Text.builder()
.content(content)
.toGroup(openIdList)
.build();
}catch (Exception e){
e.printStackTrace();
}
return null;
}
服务器报错log:
2018-05-05 11:01:47.980 ERROR 11654 --- [-nio-80-exec-10] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'timestamp' cannot be found on object of type 'java.util.HashMap' - maybe not public?] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'timestamp' cannot be found on object of type 'java.util.HashMap' - maybe not public?
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:226) ~[spring-expression-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94) ~[spring-expression-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:81) ~[spring-expression-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:121) ~[spring-expression-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:262) ~[spring-expression-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$ExpressionResolver.resolvePlaceholder(ErrorMvcAutoConfiguration.java:288) ~[spring-boot-autoconfigure-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
at org.springframework.boot.autoconfigure.web.NonRecursivePropertyPlaceholderHelper$NonRecursivePlaceholderResolver.resolvePlaceholder(NonRecursivePropertyPlaceholderHelper.java:56) ~[spring-boot-autoconfigure-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:147) ~[spring-core-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.boot.autoconfigure.web.NonRecursivePropertyPlaceholderHelper.parseStringValue(NonRecursivePropertyPlaceholderHelper.java:38) ~[spring-boot-autoconfigure-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$SpelView.render(ErrorMvcAutoConfiguration.java:226) ~[spring-boot-autoconfigure-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) ~[spring-security-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar!/:8.5.23]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
我把maven换成gradle
然后用war包启动
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.zk.weixin.config.message.WxAsyncMessageConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxMediaManager' defined in weixin.config.media.WxMediaConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [weixin.module.media.WxMediaManager]: Factory method 'wxMediaManager' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxMediaStore' defined in weixin.config.media.WxMediaConfiguration: Invocation of init method failed; nested exception is java.io.IOError: java.io.IOException: Wrong index checksum, store was not closed properly and could be corrupted.
没有找到实现的类,无法查看实现的细节
微信公众号的用户分组原本好像是用过Tag的管理来完成的,那么如果要实现分组推送是否可实现?
例如:
数据库DB中存在表User,用于保存用户信息:微信号,用户名称,用户类别,……
以用户类别为例,若将用户类别分为A,B,C三类,在分组推送时需要给B类用户推送消息,实现时是先通过数据库找到所有B类用户,然后给所有B类用户贴上标签X(假设表的列数大于每个用户可贴标签最大数量),然后通过微信公众号提供的API来给所有贴着X标签的用户推送信息,这样么?
————
对于(假设表的列数大于每个用户可贴标签最大数量)的解释:如果列数小的话只要把类别直接给用户贴标签就行了,但是这一般在数据库设计比较复杂的情况下都不够吧……所以提出了这样的疑问qwq
————
萌新刚刚接触微信公众号,还只注册了一个个人级别的订阅号,有些尝试可能还没有进行,当前的想法是这样,还望指点qwq
比如关注事件,发现有二维码参数的话,就先进关注事件,再进通配符的扫码事件。纯扫码事件的话,就直接进通配符的扫码事件。
你好,HikariShine:
fastboot-weixin 0.6.2 版本无法设置属性wx.mvc.interceptor.include-patterns。
spring boot提示信息如下:
Failed to bind properties under 'wx.mvc.interceptor' to com.mxixm.fastboot.weixin.config.WxProperties$Mvc$Interceptor:
Reason: No setter found for property: include-patterns
Action:
Update your application's configuration
看了源码,确实是没有提供setter方法。
wxMessageTemplate.sendMessage() 使用API推送消息没有反应。
微信公众号后台服务器基本配置报token验证失败({"base_resp":{"ret":200302,"err_msg":"verify token fail"}}),我的链接地址,自定义token都没问题。而且后台日志打印了:
c.m.f.w.service.WxBuildinVerifyService : ======verify start======
c.m.f.w.service.WxBuildinVerifyService : signature:b5beeebd18005cd7aa06d60c2001cb44e274d42be,timestamp:15121094832,nonce:14113480680,echostr:152911519570616039291
c.m.f.w.service.WxBuildinVerifyService : ======verify success end======
我用的是0.3.3版的fastboot-weixin,还请作者帮忙看下
Hi, in FastBootWeixin master branch, classes with the same fully-qualified name org.apache.commons.logging.LogFactory are included in two different libraries, i.e., org.slf4j:jcl-over-slf4j:1.7.25 and commons-logging:commons-logging:1.2.
According to "first declaration wins" class loading strategy, only the class in org.slf4j:jcl-over-slf4j:1.7.25 can be loaded, and that in commons-logging:commons-logging:1.2 will be shadowed.
By further analyzing, your project expects to invoke method <org.apache.commons.logging.LogFactory: org.apache.commons.logging.LogFactory getFactory()> in commons-logging:commons-logging:1.2. As it has been shadowed, so that this method defined in org.slf4j:jcl-over-slf4j:1.7.25 is actually forced to be referenced via the following invocation path:
<com.mxixm.fastboot.weixin.config.invoker.WxInvokerConfiguration: com.mxixm.fastboot.weixin.service.invoker.executor.WxApiTemplate wxApiTemplate()> D:\testcase\TestProject\FastBootWeixin-0.3.7\target\classes
<com.mxixm.fastboot.weixin.service.invoker.component.WxApiHttpRequestFactory: void <init>(com.mxixm.fastboot.weixin.config.WxProperties)> D:\testcase\TestProject\FastBootWeixin-0.3.7\target\classes
<com.mxixm.fastboot.weixin.service.invoker.component.WxApiHttpRequestFactory: org.springframework.http.client.ClientHttpRequestFactory getClientHttpRequestFactory()> D:\testcase\TestProject\FastBootWeixin-0.3.7\target\classes
<com.mxixm.fastboot.weixin.service.invoker.component.WxApiHttpRequestFactory: org.apache.http.client.HttpClient getHttpClient()> D:\testcase\TestProject\FastBootWeixin-0.3.7\target\classes
<org.apache.http.impl.client.HttpClientBuilder: org.apache.http.impl.client.CloseableHttpClient build()> D:\cEnvironment\repository\org\apache\httpcomponents\httpclient\4.5.3\httpclient-4.5.3.jar
<org.apache.http.impl.client.InternalHttpClient: void <init>(org.apache.http.impl.execchain.ClientExecChain,org.apache.http.conn.HttpClientConnectionManager,org.apache.http.conn.routing.HttpRoutePlanner,org.apache.http.config.Lookup,org.apache.http.config.Lookup,org.apache.http.client.CookieStore,org.apache.http.client.CredentialsProvider,org.apache.http.client.config.RequestConfig,java.util.List)> D:\cEnvironment\repository\org\apache\httpcomponents\httpclient\4.5.3\httpclient-4.5.3.jar
<org.apache.commons.logging.LogFactory: org.apache.commons.logging.Log getLog(java.lang.Class)> D:\cEnvironment\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
<org.apache.commons.logging.LogFactory: org.apache.commons.logging.LogFactory getFactory()>
Although both of these two conflicting classes contain the referenced method (with the same signature), they have completely different implementations. This issue will not lead to runtime crashes, but it can introduce inconsistent semantic hehavior by changing the control flows and data flows.
Reverse the declaration order of org.slf4j:jcl-over-slf4j:1.7.25 and commons-logging:commons-logging:1.2 in pom.xml.
Then, according to "first declaration wins" class loading strategy, class org.apache.commons.logging.LogFactory in commons-logging:commons-logging:1.2 can be loaded (the version that FastBootWeixin expects to reference by static analysis).
This fix will not affect other libraries or class, except the above duplicate class.
Dependency tree:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fastboot-weixin ---
[INFO] com.mxixm:fastboot-weixin:jar:0.6.2
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.6.RELEASE:provided
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.6.RELEASE:provided
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.5.6.RELEASE:provided
[INFO] | | | +- (org.springframework:spring-core:jar:4.3.10.RELEASE:provided - omitted for duplicate)
[INFO] | | | - (org.springframework:spring-context:jar:4.3.10.RELEASE:provided - omitted for duplicate)
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.6.RELEASE:provided
[INFO] | | | - (org.springframework.boot:spring-boot:jar:1.5.6.RELEASE:provided - omitted for duplicate)
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.6.RELEASE:provided
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.11:provided
[INFO] | | | | +- ch.qos.logback:logback-core:jar:1.1.11:provided
[INFO] | | | | - org.slf4j:slf4j-api:jar:1.7.22:provided
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.25:provided
[INFO] | | | | - (org.slf4j:slf4j-api:jar:1.7.25:provided - omitted for conflict with 1.7.22)
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:provided
[INFO] | | | | - (org.slf4j:slf4j-api:jar:1.7.25:provided - omitted for conflict with 1.7.22)
[INFO] | | | - org.slf4j:log4j-over-slf4j:jar:1.7.25:provided
[INFO] | | | - (org.slf4j:slf4j-api:jar:1.7.25:provided - omitted for conflict with 1.7.22)
[INFO] | | +- org.springframework:spring-core:jar:4.3.10.RELEASE:provided
[INFO] | | - org.yaml:snakeyaml:jar:1.17:provided
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.6.RELEASE:provided
......
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.4.6:provided
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.3:provided
[INFO] | +- (org.apache.httpcomponents:httpcore:jar:4.4.6:provided - omitted for duplicate)
[INFO] | +- commons-logging:commons-logging:jar:1.2:provided
[INFO] | - commons-codec:commons-codec:jar:1.9:provided
[INFO] +- org.mapdb:mapdb:jar:1.0.9:compile
[INFO] - org.springframework.boot:spring-boot-configuration-processor:jar:1.5.6.RELEASE:provided
[INFO] - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:provided
Thanks!
Best regards,
Coco
授权登录后,绑定小程序会有unionId字段:
{"access_token":"18_aGjq2hnTgczLCQ5873dJMMhgvWeOH3cXBlhsUsdgqItIZmiwi5kWoIVURXyKlF1FeOywew4Sp2Dfl-ytnVPVDPSH7fyrC-40vh6Yuo4dJHk","expires_in":7200,"refresh_token":"18_nnmCaSE2Kv6ZqhCe2bSgljFUi1hbfUM_QBd3oMakjmqNjfNGP0Fj_Tgvkbnc1tGUBw1j61YSAQuAQpW6p-BG4w4WepT8KqgbVVXqfcMqw4k","openid":"oXIEht9111k1gh7D2nJ8CFdrvYdE","scope":"snsapi_userinfo","unionid":"oREGRwwE4h111aTQuaaexwMQnr5ZFA"}
com.mxixm.fastboot.weixin.service.WxBaseService::getWxWebUserByBuilder 会抛异常:com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "unionid" (class com.mxixm.fastboot.weixin.web.WxWebUser), not marked as ignorable (5 known properties: "expires_in", "scope", "refresh_token", "access_token", "openid"])
at [Source: (String)"{"access_token":"18_aGjq2hnTgczLCQ5873dJMMhgvWeOH3cXBlhsUsdgqItIZmiwi5kWoIVURXyKlF1FeOywew4Sp2Dfl-ytnVPVDPSH7fyrC-40vh6Yuo4dJHk","expires_in":7200,"refresh_token":"18_nnmCaSE2Kv6ZqhCe2bSgljFUi1hbfUM_QBd3oMakjmqNjfNGP0Fj_Tgvkbnc1tGUBw1j61YSAQuAQpW6p-BG4w4WepT8KqgbVVXqfcMqw4k","openid":"oXIEht9y_Jk1gh7D2nJ8CFdrvYdE","scope":"snsapi_userinfo","unionid":"oREGRwwE4hAaTQuaaexwMQnr5ZFA"}"; line: 1, column: 354] (through reference chain: com.mxixm.fastboot.weixin.web.WxWebUser["unionid"])
服务器验证url需要填什么?只要到xxx.com就够了还是要具体到方法?需要自己写@RequestMapping("")还是内置了一个默认的接口?求解答
小程序事件请求内容如下:
<xml> <ToUserName> <![CDATA[gh_fe5a5486b3c4]]> </ToUserName> <FromUserName> <![CDATA[o6-9puPNx-UocKv-eLbP--zxZM6g]]> </FromUserName> <CreateTime>1552288627</CreateTime> <MsgType> <![CDATA[event]]> </MsgType> <Event> <![CDATA[view_miniprogram]]> </Event> <EventKey> <![CDATA[pages/index/index]]> </EventKey> <MenuId>439834977</MenuId> </xml>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.