0

在创建外部 api 时,我使用 h2 数据库作为模拟。现在创建了这个 api,我们想一起删除我们的模拟服务(使用 h2 数据库)。无论我尝试什么(在我们的项目中没有 h2 hibernate 的痕迹,也没有任何与 jpa 相关的东西),但我无法启动我的应用程序,因为它一直在尝试配置数据库:

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

Description:

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 pallas_local_disable_tamper_proofing,pallas-local-logging,local are currently active).

还有错误:完全启动Tomcat上下文时出错:

2020-11-18_21:31:19.713 [main] ERROR o.s.b.web.embedded.tomcat.TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'tracingFilter' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.class]: Unsatisfied dependency expressed through method 'tracingFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpTracing' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.class]: Unsatisfied dependency expressed through method 'httpTracing' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sleuthSkipPatternProvider' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.sleuth.instrument.web.SkipPatternProvider]: Factory method 'sleuthSkipPatternProvider' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor 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 

应用程序.yml:

spring:
  application:
    name: my-app
  resources:
    add-mappings: true

springfox:
  documentation:
    swagger:
      v2:
        path: /v1/api-docs

management:
  server:
    port: 8083
    ssl:
      enabled: false
  endpoint:
    metrics:
      enabled: true
    prometheus:
      enabled: true
    health:
      show-details: always
  endpoints:
    web:
      exposure:
        include: info, health, metrics, prometheus, loggers
  metrics:
    export:
      prometheus:
        enabled: true
    distribution:
      percentiles-histogram.http.server.requests: true
      sla.http.server.requests: 1ms, 5ms, 20ms, 50ms, 150ms
    health:
      jms:
        enabled: false

spring.profiles: tls

server:
  ssl:
    enabled: true
  servlet:
    context-path: /my-app-context

任何帮助都感激不尽。

4

1 回答 1

0

显然,我的一个依赖项(对内部编写的库)导致 JPA 引导。我们最终通过执行 maven 的依赖树命令并排除 jpa 来解决此问题:

        <dependency>
            <groupId>our-group-id</groupId>
            <artifactId>...file-temporary-storage-tactical</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-jpa</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
于 2020-11-19T09:55:19.960 回答