Azure-Samples/azure-spring-boot-samples

[BUG] File Storage Sample fails to start - AzureStorageFileProtocolResolver not found

akhan-msft opened this issue · 1 comments

I used GitHub codespaces to run the project as-is but also experiencing the same issue while running the project locally, the com.azure.spring.cloud.core.resource.AzureStorageFileProtocolResolver is not injected into the FileController class. The only changes I made were to setup the values in the application.yml for my Azure subscription.

Exception stack trace below...

2023-06-28 22:18:41.805 WARN 12596 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileController' defined in file [/workspaces/azure-spring-boot-samples/storage/spring-cloud-azure-starter-storage-file-share/storage-file-sample/target/classes/com/azure/spring/sample/storage/resource/FileController.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.azure.spring.cloud.core.resource.AzureStorageFileProtocolResolver' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2023-06-28 22:18:41.809 INFO 12596 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-06-28 22:18:41.847 INFO 12596 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-06-28 22:18:41.886 ERROR 12596 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Parameter 2 of constructor in com.azure.spring.sample.storage.resource.FileController required a bean of type 'com.azure.spring.cloud.core.resource.AzureStorageFileProtocolResolver' that could not be found.

Action:

Consider defining a bean of type 'com.azure.spring.cloud.core.resource.AzureStorageFileProtocolResolver' in your configuration.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.800 s
[INFO] Finished at: 2023-06-28T22:18:41Z
[INFO] ------------------------------------------------------------------------

To Reproduce
Run the sample app as per the readme instructions.

Setup (please complete the following information):

  • OS: Cloned the project in codespaces env
  • IDE: CodeSpaces VS Code

Additional context
I am using the project as-is, have not modified any code or introduced any new libraries or modified versions, only update the application.yml file with the correct Azure file storage values for my Azure subscription.

Information Checklist

  • Bug Description Added - Done
  • Repro Steps Added - Done
  • Setup information Added - Done

Hi @akhan-msft , I didn't reproduce the same problem, could you provide more information about that, thanks!