最適なドライバクラスの問題解決を決定するために失敗しました。

ログのエラー:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-12-20 23:00:50.664 ERROR 11184 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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 (no profiles are currently active).

Disconnected from the target VM, address: '127.0.0.1:53235', transport: 'socket'

Process finished with exit code 1

:そのような文のログNOレートこのページ現在アクティブなプロファイルがあります

説明は、プロジェクトコード環境を実行しているプロファイルを構成し、かつ迅速にYML設定を見ていません。

spring:
  profiles:
    active: '@spring.active@'

私が書き、私はローカル交換してみて命令が無駄に「@ spring.active @」かもしれ

spring:
  profiles:
    #active: '@spring.active@'
    active: local

私たちのプロジェクトは、クリーンMavenと再び実行します。

Connected to the target VM, address: '127.0.0.1:53321', transport: 'socket'

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

2019-12-20 23:07:27.055  INFO 10324 --- [           main] c.s.d.SelfDisciplineApplication          : Starting SelfDisciplineApplication on Suvue with PID 10324 (Z:\personal\code_repo\self-discipline\target\classes started by yj020 in Z:\personal\code_repo\self-discipline)
2019-12-20 23:07:27.060  INFO 10324 --- [           main] c.s.d.SelfDisciplineApplication          : The following profiles are active: local
2019-12-20 23:07:27.751  INFO 10324 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-12-20 23:07:27.754  INFO 10324 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2019-12-20 23:07:27.794  INFO 10324 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 24ms. Found 0 Redis repository interfaces.
2019-12-20 23:07:28.094  INFO 10324 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-12-20 23:07:28.340  INFO 10324 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 80 (http)
2019-12-20 23:07:28.349  INFO 10324 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-12-20 23:07:28.349  INFO 10324 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.29]
2019-12-20 23:07:28.444  INFO 10324 --- [           main] o.a.c.c.C.[.[localhost].[/discipline]    : Initializing Spring embedded WebApplicationContext
2019-12-20 23:07:28.445  INFO 10324 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1328 ms
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.3.0 
2019-12-20 23:07:29.982  WARN 10324 --- [           main] c.b.m.core.metadata.TableInfoHelper      : Warn: Could not find @TableId in Class: cn.suvue.discipline.modular.entity.SetArtitleSort.
2019-12-20 23:07:30.010  WARN 10324 --- [           main] c.b.m.core.metadata.TableInfoHelper      : Warn: Could not find @TableId in Class: cn.suvue.discipline.modular.entity.Sorts.
2019-12-20 23:07:30.248  INFO 10324 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-12-20 23:07:30.586  INFO 10324 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 80 (http) with context path '/discipline'
2019-12-20 23:07:30.590  INFO 10324 --- [           main] c.s.d.SelfDisciplineApplication          : Started SelfDisciplineApplication in 4.139 seconds (JVM running for 5.441)

この時点で、プロジェクトが正常動作することができました!完了

しかし、まだ、私は問題の原因を見つけることができませんでした、和解することはできません。

いくつかの外観は、オンライン、適切な構成の下に取り付けた独自の設定に問題が見つかりました:

pom.xml

<profiles>
    <!--开发环境-->
    <profile>
        <id>dev</id>
        <properties>
            <spring.active>dev</spring.active>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
    </profile>
    <!--测试环境-->
    <profile>
        <id>test</id>
        <properties>
            <spring.active>test</spring.active>
        </properties>
    </profile>
    <!--生产环境-->
    <profile>
        <id>prod</id>
        <properties>
            <spring.active>prod</spring.active>
        </properties>
    </profile>
</profiles>

<properties>
    <resource.delimiter>@</resource.delimiter>
</properties>
<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/resources.${spring.active}</directory>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

YMLこの時点では、操作の高度なモードを使用することができます!次のとおりです。

spring:
    profiles:
        active: @spring.active@
公開された39元の記事 ウォン称賛13 ビュー2308

おすすめ

転載: blog.csdn.net/weixin_45612794/article/details/103639922