1

SpringDataのNeo4jグラフDBhello-worldsの例を使用していて、 WorldRepositoriesImpl.javaで次のコードに遭遇しました...

@Autowired private WorldRepository worldRepository;

さらに、WorldRepositoryは次のように定義されます...

public interface WorldRepository extends MyWorldRepository, 
                                         GraphRepository<World>,
                                         NamedIndexRepository<World> 
{/* no method defined here */}

奇妙なことに、私が見つけることができるクラスは実際には実装されていませんWorldRepository。それで、いくつかの質問...

これはどのように可能ですか?これはどこに文書化されていますか?これをもう少し明確にする(神秘的ではない)方法はありますか?

4

1 に答える 1

3

Running the code with a debugger attached shows that the worldRepository instance wired up by Spring is a proxy object created at runtime.

Looking at the pom.xml and the dependencies included, it looks like the spring-neo4j library bundles in some Aspects that create this implementation class at runtime.

In other words, there is no implementation of this interface declared in the source code - but one is created at runtime with AspectJ and other tools.

IntelliJ screenshot of debugger

于 2011-07-05T14:20:03.397 に答える