我嘗試使用Spring Data Neo4j編寫webapp。Spring Data Neo4j - @Autowired Repository == null
我有一個存儲庫:
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;
...
現在不能使用UserRepository在控制器,因爲它是空的...
錯誤在哪裏?
對不起,但其仍然是 「零」 ... – Tschakle 2012-07-26 11:18:09