在Spring数据Mongo存储库中使用类自动装配问题

时间:2014-11-24 01:06:57

标签: spring-data spring-boot

由于各种原因,我最终使用了Spring boot 1.2.0 RC2。 因此,spring spring mongo应用程序在spring boot1.1.8中运行良好,现在遇到了问题。没有代码被更改,除了弹簧启动1.2.0 RC2。这是由于Spring云的快照版本转移到了这个春季启动版本。

存储库类如下

@Repository
public interface OAuth2AccessTokenRepository extends MongoRepository<OAuth2AuthenticationAccessToken, String> {

    public OAuth2AuthenticationAccessToken findByTokenId(String tokenId);

    public OAuth2AuthenticationAccessToken findByRefreshToken(String refreshToken);

    public OAuth2AuthenticationAccessToken findByAuthenticationId(String authenticationId);

    public List<OAuth2AuthenticationAccessToken> findByClientIdAndUserName(String clientId, String userName);

    public List<OAuth2AuthenticationAccessToken> findByClientId(String clientId);
}

这在版本颠簸之前效果很好,现在我在日志中看到了这一点。

19:04:35.510 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner - Ignored because not a concrete top-level class: file [/Users/larrymitchell/rpilprojects/corerpilservicescomponents/channelMap/target/classes/com/cisco/services/rpil/mongo/repository/oauth2/OAuth2AccessTokenRepository.class]

我确实有另一个被识别的mongo存储库,但它被定义为类实现

@Component 
public class ChannelMapRepository { ... }

这个被认可(我将其定义为实现类,作为我遇到的另一个问题的解决方法)。这门课程得到认可,似乎工作正常。

19:04:35.513 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner - Identified candidate component class: file [/Users/larrymitchell/rpilprojects/corerpilservicescomponents/channelMap/target/classes/com/cisco/services/rpil/services/Microservice.class]

任何人都知道为什么?我查看了为什么组件扫描不起作用的各种原因,没有任何东西适合我的问题。

1 个答案:

答案 0 :(得分:0)

尝试删除@Repository注释?工作for me。这也是Github中的一个问题。

相关问题