現在、私のSpringアプリケーションへのmongodbの統合を試みています。SpringDataとMongoDBの設定エラー:MongoTemplate
私は
「ワイルドカードmongoTemplate建設、引数に関連したエラーがある春にアプリケーションの構成上しかしなど私のマシン上の初期のMongoDB環境のセットアップ、サービスの起動、
を持っています厳密ではありませんが、文書hereで説明したように、私は実際には同じXML支出を使用していた要素が見つかりませ宣言」
、ONLI最近のいくつかのチュートリアルと同じne、そして私が知る限り、正しい名前空間のURLを追加しました。だから私は今は少し迷っているものとして失われています。これについての助けがあれば幸いです。ここで
はxml構成を見ている:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- scanning comment root context of all components package directory-->
<context:component-scan base-package="com.demo" />
<!--Dispatcher servlet-->
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/view/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<!-- Configure to plugin JSON as request and response in method handler -->
<beans:bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<beans:property name="messageConverters">
<beans:list>
<beans:ref bean="jsonMessageConverter"/>
</beans:list>
</beans:property>
</beans:bean>
<!-- Configure bean to convert JSON to POJO and vice versa -->
<beans:bean id="jsonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
</beans:bean>
<!-- mongo db config -->
<mongo:mongo host="localhost" port="27017" id="mongo" />
<mongo:repositories base-package="com.demo.football.repository" />
<beans:bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg ref="mongo"/>
<constructor-arg name="databaseName" value="FootballManager"/>
</beans:bean>
</beans:beans>
どのバージョンのspring-dataとspring-data-mongodbを使用していますか? – Veeram
spring-mongo-mongodbはバージョン1.7.2です。私が知っている限り、スプリングデータの依存関係は必要ありません。 – Catresl