1
votes

I have upgraded springfox to version 2.7.0(and 2.9.2):

<springfox.version>2.7.0</springfox.version>
<spring-boot.version>1.3.3.RELEASE</spring-boot.version>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>${springfox.version}</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>${springfox.version}</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-data-rest</artifactId>
    <version>${springfox.version}</version>
</dependency>

and trying to start the application I get the next error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'documentationPluginsBootstrapper' defined in URL [jar:file:.....jar!/lib/springfox-spring-web-2.7.0.jar!/springfox/documentation/spring/web/plugins/DocumentationPluginsBootstrapper.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [java.util.List]: Error creating bean with name 'basePathAwareServicesProvider' defined in URL [jar:file:/..............!/lib/springfox-data-rest-2.7.0.jar!/springfox/documentation/spring/data/rest/BasePathAwareServicesProvider.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.spring.data.rest.BasePathAwareServicesProvider]: No default constructor found; nested exception is java.lang.NoSuchMethodException: springfox.documentation.spring.data.rest.BasePathAwareServicesProvider.(); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'basePathAwareServicesProvider' defined in URL [jar:file:............!/lib/springfox-data-rest-2.7.0.jar!/springfox/documentation/spring/data/rest/BasePathAwareServicesProvider.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.spring.data.rest.BasePathAwareServicesProvider]: No default constructor found; nested exception is java.lang.NoSuchMethodException: springfox.documentation.spring.data.rest. BasePathAwareServicesProvider. init ()

No default constructor found; BasePathAwareServicesProvider. init ()

I have annotated the classes like this in order to avoid some errors with swaggers-ui.html:

@Configuration
@Profile("swaggerEnabled")
@EnableSwagger2
@EnableWebMvc
@Import(SpringDataRestConfiguration.class)
public class SwaggerConfiguration {

The Springboot application:

@EnableSwagger2
@EnableWebMvc
@SpringBootApplication
@Import(value = {
        ......class,})
@Order(Ordered.HIGHEST_PRECEDENCE)
@ComponentScan(basePackages = {"....."})
public class PlatformApiApplication {

I've tried some solutions from github but nothing works. Can somebody help me? thanks.

1

1 Answers

0
votes

Removing the line:

@Import(SpringDataRestConfiguration.class)

The error dissapears