如何使用XML配置启用@EnableSpringDataWebSupport

时间:2018-07-22 15:54:13

标签: spring spring-mvc

我正在使用Spring 5.0.2.RELEASESpring Data的以下依赖项:

    <!-- Spring Data JPA -->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>2.0.6.RELEASE</version>
    </dependency>

在DispatcherServlet.xml中创建:

<bean id="mvcConversionService"
        class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />

    <bean
        class="org.springframework.data.web.config.SpringDataWebConfiguration">
        <constructor-arg ref="mvcConversionService" />
    </bean>
    <bean
        class="org.springframework.data.web.config.QuerydslWebConfiguration" />

    <mvc:annotation-driven
        conversion-service="mvcConversionService">
        <mvc:argument-resolvers>
            <ref bean="sortResolver" />
            <ref bean="pageableResolver" />
            <ref bean="querydslPredicateArgumentResolver" />
        </mvc:argument-resolvers>
    </mvc:annotation-driven>

但是,再次出现的消息是:

No constructor with 1 argument defined in class 'org.springframework.data.web.config.SpringDataWebConfiguration' 

谁可以教我如何解决问题?

1 个答案:

答案 0 :(得分:0)

看到错误,似乎是您错误地配置了SpringDataWebConfiguration

<bean class="org.springframework.data.web.config.SpringDataWebConfiguration" />

请参阅此Link