我尝试使用 Spring Data Neo4j 编写一个 webapp。
我有一个存储库:
public interface UserRepository extends GraphRepository<Neo4jUser> {}
一个applicationcontext.xml:
...
<context:component-scan base-package="de.wilke.test.neo4j" >
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- REST Connection to Neo4j server -->
<bean id="restGraphDatabase"
class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
<constructor-arg value="http://localhost:7474/db/data/" />
</bean>
<bean id="myservice" class="de.wilke.test.neo4j.Neo4jResource">
</bean>
<!-- Neo4j configuration (template) -->
<neo4j:config graphDatabaseService="restGraphDatabase" />
<!-- Package w/ automagic repositories -->
<neo4j:repositories base-package="de.wilke.test.repository" />
还有我的 Neo4jResource:
@Controller
public class Neo4jResource {
@Autowired
public static UserRepository repo;
...
现在不能在 Controller 中使用 UserRepository,因为它是空的......
错误在哪里?