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

bug with AppConfig with Cosmos #7

Description

@survivant

Hello, thank you for your example, it's a nice starting point for a demo with App Configuration. I try to add a @repository in the example and at the runtime Spring with not able to Autowired the Repository. I try the sample from Microsoft because I found your sample but I got the same error with there samples (Azure-Samples/azure-spring-boot-samples#647)

I'm pooking to see if you had that error and know how to fix it.

I use java 17, I setup the environment variables and launched mvn spring-boot:run and got this error
azure-app-configuration-with-cosmos.zip

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

2023-01-25 11:26:21.351  INFO 19140 --- [           main] c.azure.identity.EnvironmentCredential   : Azure Identity => EnvironmentCredential invoking ClientSecretCredential
2023-01-25 11:26:21.364  INFO 19140 --- [           main] c.a.c.i.jackson.JacksonVersion           : Package versions: jackson-core=2.13.4, jackson-databind=2.13.4-2, jackson-dataformat-xml=2.13.4, jackson-datatype-jsr310=2.13.4, azure-core=1.32.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/de
pendency/troubleshoot
2023-01-25 11:26:22.263  INFO 19140 --- [onPool-worker-1] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [https://XXX.azconfig.io/.default]: SUCCESS
2023-01-25 11:26:22.263  INFO 19140 --- [onPool-worker-1] c.a.c.implementation.AccessTokenCache    : Acquired a new access token.
2023-01-25 11:26:22.455  INFO 19140 --- [           main] c.azure.identity.EnvironmentCredential   : Azure Identity => EnvironmentCredential invoking ClientSecretCredential
2023-01-25 11:26:22.747  INFO 19140 --- [onPool-worker-1] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [https://vault.azure.net/.default]: SUCCESS
2023-01-25 11:26:22.748  INFO 19140 --- [onPool-worker-1] c.a.c.implementation.AccessTokenCache    : Acquired a new access token.
2023-01-25 11:26:23.054  INFO 19140 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-/application/https://XXX.azconfig.io/'}]
2023-01-25 11:26:23.057  INFO 19140 --- [           main] c.s.a.AzureAppConfigurationApplication   : No active profile set, falling back to 1 default profile: "default"
2023-01-25 11:26:23.461  INFO 19140 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=82b554b9-9386-312e-a141-a1e594c2b07c
2023-01-25 11:26:23.626  INFO 19140 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-01-25 11:26:23.631  INFO 19140 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-01-25 11:26:23.631  INFO 19140 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.71]
2023-01-25 11:26:23.714  INFO 19140 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-01-25 11:26:23.715  INFO 19140 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 652 ms
2023-01-25 11:26:23.822  WARN 19140 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'databaseConfigController' define
d in file [C:\to-delete\azure-app-configuration\target\classes\com\sheldon\azureappconfiguration\api\controller\DatabaseConfigController.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying be
an of type 'com.sheldon.azureappconfiguration.infrastructure.UserRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2023-01-25 11:26:23.823  INFO 19140 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-01-25 11:26:23.834  INFO 19140 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-01-25 11:26:23.847 ERROR 19140 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 1 of constructor in com.sheldon.azureappconfiguration.api.controller.DatabaseConfigController required a bean of type 'com.sheldon.azureappconfiguration.infrastructure.UserRepository' that could not be found.


Action:

Consider defining a bean of type 'com.sheldon.azureappconfiguration.infrastructure.UserRepository' in your configuration.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.523 s
[INFO] Finished at: 2023-01-25T11:26:24-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.8:run (default-cli) on project azure-app-configuration: 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
PS C:\to-delete\azure-app-configuration> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions