configurei tudo no config-server e no fornecedor, subo o config e o eureka e dps subo fornecedor mas tenho esse erro:
2022-10-05 15:07:32.489 INFO 9247 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2022-10-05 15:07:32.653 INFO 9247 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=fornecedor, profiles=[default], label=null, version=null, state=null
2022-10-05 15:07:32.655 INFO 9247 --- [ restartedMain] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-file:../microsservice-repo/fornecedor.yml'}]
2022-10-05 15:07:32.668 INFO 9247 --- [ restartedMain] m.fornecedor.FornecedorMsApplication : The following 1 profile is active: "default"
2022-10-05 15:07:33.505 INFO 9247 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-10-05 15:07:33.686 INFO 9247 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 169 ms. Found 1 JPA repository interfaces.
2022-10-05 15:07:34.101 INFO 9247 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=8832165f-3b51-3910-a4af-0a59fed7ad7f
2022-10-05 15:07:34.801 INFO 9247 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2022-10-05 15:07:34.814 INFO 9247 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-10-05 15:07:34.814 INFO 9247 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-10-05 15:07:34.912 INFO 9247 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-10-05 15:07:34.912 INFO 9247 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2208 ms
2022-10-05 15:07:34.992 WARN 9247 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2022-10-05 15:07:34.995 INFO 9247 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-10-05 15:07:35.019 INFO 9247 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles default are currently active).
Process finished with exit code 0
Como podem ver no inicio ele faz o fetch das configs, mas por algum motivo n recupera a informação. Resposta do endpoint: localhost:8888/fornecedor/default:
{
"name": "fornecedor",
"profiles": [
"default"
],
"label": null,
"version": null,
"state": null,
"propertySources": [
{
"name": "file:../microsservice-repo/fornecedor.yml",
"source": {
"datasource.url": "jdbc:mysql://localhost:3306/fornecedor",
"datasource.password": "bcd127",
"datasource.username": "alura",
"jpa.show-sql": true,
"jpa.hibernate.ddl-auto": "update"
}
}
]
}
o codigo está aqui: https://github.com/karlgama/config-server-spring-cloud https://github.com/karlgama/microservice-fornecedor-estudos