Azure-Samples/azure-spring-boot-samples

azure-spring-integration-sample-servicebus not working with msi/service principle

Iron-Stark opened this issue · 9 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Updated the application-sp.yaml file with the required details:

      client-id: [service-principal-id]
      client-secret: [service-principal-secret]
      tenant-id: [tenant-id]
      resource-group: [resource-group]

After that ran the ServiceBusIntegrationApplication.java file which fails with the following error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueMessageChannelAdapter' defined in class path resource [com/azure/spring/sample/servicebus/QueueReceiveController.class]: Unsatisfied dependency expressed through method 'queueMessageChannelAdapter' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueOperation' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueOperation' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueClientFactory' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueClientFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

I tried adding the following piece of code to the QueueControllers:

@Bean
@ServiceActivator(inputChannel = OUTPUT_CHANNEL)
public ServiceBusConnectionStringProvider serviceBusConnectionStringProvider(){
 return new ServiceBusConnectionStringProvider(connectionString);
}

But the issue is that ServiceBusConnectionStringProvider can only be created with connectionString and for msi/sp mode we don't have that info.

Actually even the normal case was not working till I created this bean (Updating application.yaml).

Any log messages given by the failure

As given above

Expected/desired behavior

Putting those properties in the yaml file shouldn't have thrown that error.

OS and Version?

macOS Catalina

Versions

10.15.7

Mention any other details that might be useful


Thanks! We'll be in touch soon.

@Iron-Stark thanks for reaching us, I am looking into this issue and I will reply you today.

Hi, @Iron-Stark I tried azure-spring-integration-sample-servicebus with configration below, and it worked, I didn't reproduce your problem.

spring:
  cloud:
    azure:
      client-id: [client-id]
      client-secret: [client-secret]
      tenant-id: [tenant]
      resource-group: [resource-group]
      servicebus:
        namespace: [servciebusgzh]

image

Did you give your principal the right role through the Access control (IAM)?

@backwind1233 Thank you for your reply.

Yes I did give my principal the owner role through IAM. I am facing two problems:

  1. The YAML configs are not working for me directly. I had to put things in application.properties file instead. For e.g. for connection string to work - I created a application.properties file and added this property:spring.cloud.azure.servicebus.connectionstring=Endpoint=....
  2. Even the connection string sample is not working out of the box. I am getting an exception saying:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider'.

I had to create that bean using the connection string and then the example worked for me.

So yaml is not working directly and then I am getting the no such bean exception in all 3 but can only resolve it for the first one by creating the bean. Just to be clear that I am not missing any step, after cloning the repo I provided those details in the yaml file, changed the queue names and then ran mvn spring-boot:run. Do I have to do something for the code to read configuration from the YAML file instead?

I have attached screenshots of all the things I am providing and the error message I am getting:

`

[INFO] Scanning for projects...
[INFO] 
[INFO] ----< com.azure.spring:azure-spring-integration-sample-servicebus >-----
[INFO] Building Azure Spring Integration Sample Service Bus 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.5.0:run (default-cli) > test-compile @ azure-spring-integration-sample-servicebus >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ azure-spring-integration-sample-servicebus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ azure-spring-integration-sample-servicebus ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ azure-spring-integration-sample-servicebus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ azure-spring-integration-sample-servicebus ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< spring-boot-maven-plugin:2.5.0:run (default-cli) < test-compile @ azure-spring-integration-sample-servicebus <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.5.0:run (default-cli) @ azure-spring-integration-sample-servicebus ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.0)

2021-08-11 14:51:58.188  INFO 73000 --- [           main] a.s.s.s.ServiceBusIntegrationApplication : Starting ServiceBusIntegrationApplication using Java 11.0.2 on Dewangs-MacBook-Pro.local with PID 73000 (/Users/sultania/micro/azure-spring-boot-samples/servicebus/azure-spring-cloud-starter-servicebus/servicebus-integration/target/classes started by sultania in /Users/sultania/micro/azure-spring-boot-samples/servicebus/azure-spring-cloud-starter-servicebus/servicebus-integration)
2021-08-11 14:51:58.190  INFO 73000 --- [           main] a.s.s.s.ServiceBusIntegrationApplication : No active profile set, falling back to default profiles: default
2021-08-11 14:51:58.691  INFO 73000 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2021-08-11 14:51:58.697  INFO 73000 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2021-08-11 14:51:58.759  INFO 73000 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-08-11 14:51:58.760  INFO 73000 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-08-11 14:51:58.765  INFO 73000 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-08-11 14:51:58.884  INFO 73000 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-08-11 14:51:58.890  INFO 73000 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-08-11 14:51:58.891  INFO 73000 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-08-11 14:51:58.997  INFO 73000 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-08-11 14:51:58.997  INFO 73000 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 773 ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.util.ReflectionUtils (file:/Users/sultania/.m2/repository/org/springframework/spring-core/5.3.7/spring-core-5.3.7.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class)
WARNING: Please consider reporting this to the maintainers of org.springframework.util.ReflectionUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-08-11 14:51:59.090  WARN 73000 --- [           main] s.c.a.s.AzureServiceBusAutoConfiguration : Can't construct the ServiceBusConnectionStringProvider, namespace: null, connectionString: null
2021-08-11 14:51:59.092  WARN 73000 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueMessageChannelAdapter' defined in class path resource [com/azure/spring/sample/servicebus/QueueReceiveController.class]: Unsatisfied dependency expressed through method 'queueMessageChannelAdapter' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueOperation' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueOperation' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueClientFactory' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueClientFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2021-08-11 14:51:59.095  INFO 73000 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-08-11 14:51:59.116  INFO 73000 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-08-11 14:51:59.131 ERROR 73000 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueMessageChannelAdapter' defined in class path resource [com/azure/spring/sample/servicebus/QueueReceiveController.class]: Unsatisfied dependency expressed through method 'queueMessageChannelAdapter' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueOperation' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueOperation' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueClientFactory' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueClientFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.7.jar:5.3.7]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.7.jar:5.3.7]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.0.jar:2.5.0]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.5.0.jar:2.5.0]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.5.0.jar:2.5.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:337) ~[spring-boot-2.5.0.jar:2.5.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1336) ~[spring-boot-2.5.0.jar:2.5.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1325) ~[spring-boot-2.5.0.jar:2.5.0]
        at com.azure.spring.sample.servicebus.ServiceBusIntegrationApplication.main(ServiceBusIntegrationApplication.java:20) ~[classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueOperation' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueOperation' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueClientFactory' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueClientFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.7.jar:5.3.7]
        ... 19 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queueClientFactory' defined in class path resource [com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfiguration.class]: Unsatisfied dependency expressed through method 'queueClientFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.7.jar:5.3.7]
        ... 33 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1790) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1385) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.7.jar:5.3.7]
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.7.jar:5.3.7]
        ... 47 common frames omitted

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.170 s
[INFO] Finished at: 2021-08-11T14:51:59-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.0:run (default-cli) on project azure-spring-integration-sample-servicebus: Application finished with exit code: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
`

In the above error message I updated the application-sp.yaml file with the required values and then did mvn spring-boot:run.

Maven home: /opt/apache-maven
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"

this is my environment

In the above error message I updated the application-sp.yaml file with the required values and then did mvn spring-boot:run.
The YAML configs are not working for me directly.

Hi @Iron-Stark, thank you for your reply. I think you are right(The YAML configs are not working for me directly).

Since you were using application-sp.yaml,there are two ways you can try:

  1. I think you can run with mvn spring-boot:run -Dspring-boot.run.profiles=sp,
    this will use application-sp.yaml as configuration file.
  2. Still run with spring-boot:run but add code below to your application.yaml to activate application-sp.yaml
    spring:
      profiles:
        active:sp
    

close this issue because there is no response more than 10 days.