Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Documentdb starter conflict with Feign starter #306

Closed
AwesomeSauce716 opened this issue Mar 22, 2018 · 8 comments
Closed

Documentdb starter conflict with Feign starter #306

AwesomeSauce716 opened this issue Mar 22, 2018 · 8 comments
Labels
Milestone

Comments

@AwesomeSauce716
Copy link

Environment

  • Spring boot starter:

    • documentdb spring boot starter
    • spring-cloud-starter-openfeign
  • OS Type: Windows/Linux/MacOS

  • Java version:

    • 1.8

Summary

With both spring cloud starters on the classpath a runtime error is thrown on statrup and the application won't start

Reproduce steps

Here is and example pom.xml with the error message.
pom.xml:


4.0.0

<groupId>com.vml.ford.sfi.inv</groupId>
<artifactId>tmp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>tmp</name>
<description>Inventory Service for Shop from Inventory system</description>

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.0.0.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
	<spring-cloud.version>Finchley.M8</spring-cloud.version>
</properties>

<dependencies>
	
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-starter-openfeign</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
	
	<dependency>
		<groupId>com.microsoft.azure</groupId>
		<artifactId>azure-documentdb-spring-boot-starter</artifactId>
	</dependency>
</dependencies>

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-dependencies</artifactId>
			<version>${spring-cloud.version}</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
		<dependency>
			<groupId>com.microsoft.azure</groupId>
			<artifactId>azure-spring-boot-bom</artifactId>
			<version>2.0.1</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
	</plugins>
</build>

<repositories>
	<repository>
		<id>spring-milestones</id>
		<name>Spring Milestones</name>
		<url>https://repo.spring.io/milestone</url>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
	</repository>
</repositories>

Error:
2018-03-22 14:40:30.738 ERROR 20280 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ISomeRepo': Unsatisfied dependency expressed through constructor parameter 1: Ambiguous argument values for parameter of type [com.microsoft.azure.spring.data.documentdb.core.DocumentDbOperations] - did you specify the correct bean references as arguments?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:716) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:946) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:833) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:557) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:427) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:390) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:384) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:999) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:339) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:334) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer.isApplicable(RefreshAutoConfiguration.java:152) ~[spring-cloud-context-2.0.0.M8.jar:2.0.0.M8]
at org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer.postProcessBeanDefinitionRegistry(RefreshAutoConfiguration.java:123) ~[spring-cloud-context-2.0.0.M8.jar:2.0.0.M8]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:123) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at com.vml.ford.sfi.inv.TmpApplication.main(TmpApplication.java:10) [classes/:na]

Expected Results

The application to start and to be able to create feignclients and azure documentdb repositories in the same project.

Actual Results

The application won't start and throws the error above.

@AwesomeSauce716
Copy link
Author

I tried adding base packages as well. It didn't make a difference.

@SpringBootApplication
@EnableFeignClients(basePackages = {"com.vml.ford.sfi.inv.feign"})
@EnableDocumentDbRepositories(basePackages = {"com.vml.ford.sfi.inv.repo"})
public class TmpApplication {

public static void main(String[] args) {
	SpringApplication.run(TmpApplication.class, args);
}

}

@AwesomeSauce716
Copy link
Author

Thank you so much!

@Incarnation-p-lee
Copy link
Contributor

Incarnation-p-lee commented Mar 24, 2018

@AwesomeSauce716
It is one known issue due to incompatibility assumption in spring-data-commons referenced by spring-data-documentdb. We fixed this issue in
https://github.com/Microsoft/spring-data-documentdb/releases/tag/v2.0.2
But it may cost some time from azure-spring-boot. You may need to specific spring-data-documentdb version, and have a try. Any problems please contact us directly.

@aekbotensm
Copy link

aekbotensm commented Apr 13, 2018

@Incarnation-p-lee
I am facing the same issue. But i cannot use v2.0.2 as i am using spring boot version 1.5.x.
Also, spring cloud BRIXTON release which i need to use is not supported for spring boot v2 and above.

Is there a way to get this fixed on the 0.1.x branch?

@Incarnation-p-lee
Copy link
Contributor

@aekbotensm
Thanks for you commits. Also as a reminder to use.
The documentdb 0.1.x release will be available in a short future. I will infor you when ready.

@aekbotensm
Copy link

aekbotensm commented Apr 16, 2018

@Incarnation-p-lee

The error i get is a bit different.

Description:

Parameter 0 of constructor in com.microsoft.azure.spring.data.documentdb.repository.support.DocumentDbRepositoryFactoryBean required a bean of type 'java.lang.Class' that could not be found.

Action:

Consider defining a bean of type 'java.lang.Class' in your configuration.

@Incarnation-p-lee
Copy link
Contributor

@aekbotensm
Thanks for you issue and information. We have release new documentdb version 1.5 for spring boot 1.5.x. Could you please help to have a try? Thanks in advance!

documentdb for spring boot 1.5.x

@xscript xscript added this to the Backlog milestone Nov 21, 2018
@Incarnation-p-lee
Copy link
Contributor

I may close this issue for now as fix released already. If you still meet similar issue, please feel free to reopen.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants