Skip to content

小程序demo和spring-boot-starter-data-rest冲突 #259

Closed

Description

@qiaolb

我在使用小程序接口时,引入spring-boot-starter-data-rest会导致启动错误。测试方法,可以在weixin-java-miniapp-demo的pom.xml中增加:

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>

错误如下:


Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-06-29 09:01:42.715 ERROR 1110 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method WxMaService in com.github.binarywang.demo.wechat.config.WxMaConfiguration required a bean of type 'cn.binarywang.wx.miniapp.config.WxMaConfig' that could not be found.


Action:

Consider defining a bean of type 'cn.binarywang.wx.miniapp.config.WxMaConfig' in your configuration.


Process finished with exit code 1

在公众号中无此问题。
请看看怎么回事,谢谢!

Activity

  1. changed the title [-]小程序也spring-boot-starter-data-rest冲突[/-] [+]小程序和spring-boot-starter-data-rest冲突[/+] on Jun 29, 2017
  2. binarywang commented on Jun 29, 2017

    @binarywang
    Owner

    你这是Demo的问题吧,下次尽量到对应Demo项目下讨论吧,我看了你的问题,明显后面给出了提示的吧?Action部分

  3. qiaolb commented on Jun 29, 2017

    @qiaolb
    Author

    我是在我的项目中使用weixin-java-miniapp,版本2.7.0。因为和spring data REST冲突,所以我在Demo中确认是否有这个问题。
    根据提示,应该是WxMaConfig没有定义Bean,但实际是有的。

        @Bean
        @ConditionalOnMissingBean
        public WxMaConfig config() {
            WxMaInMemoryConfig config = new WxMaInMemoryConfig();
            config.setAppid(this.properties.getAppid());
            config.setSecret(this.properties.getSecret());
            config.setToken(this.properties.getToken());
            config.setAesKey(this.properties.getAesKey());
            config.setMsgDataFormat(this.properties.getMsgDataFormat());
    
            return config;
        }
    
        @Bean
        @ConditionalOnMissingBean
        public WxMaService wxMaService(WxMaConfig config) {
            WxMaService service = new WxMaServiceImpl();
            service.setWxMaConfig(config);
            return service;
        }

    而且奇怪的是如果我去掉spring-boot-starter-data-rest的依赖就没有错误了。

  4. binarywang commented on Jun 29, 2017

    @binarywang
    Owner

    可能是spring-boot-starter-data-rest里有什么配置把原有配置给覆盖了。
    你是用debug模式检查下吧。

    涉及到spring boot的相关问题,暂时先关闭了,如果需要继续讨论在demo里新开issue讨论吧

  5. changed the title [-]小程序和spring-boot-starter-data-rest冲突[/-] [+]小程序demo和spring-boot-starter-data-rest冲突[/+] on Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions