由于种种原因,我最终使用了 Spring Boot 1.2.0 RC2。 因此,一个在 spring boot1.1.8 中运行良好的 spring data mongo 应用程序现在出现了问题。 除了升级到 Spring Boot 1.2.0 RC2 之外,没有更改任何代码。 这是由于 Spring Cloud 的快照版本迁移到了此 Spring Boot 版本。
repository类如下
@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]
有人知道为什么吗? 我查找了组件扫描不起作用的各种原因,但没有任何原因适合我的问题。