- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在 IntelliJ IDEA Community IDE 中编写一个 Java 项目。本项目技术栈:
我在项目中有 application.yml
文件来连接数据库,但是当我运行我的应用程序时,出现错误:
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
我不知道为什么我的项目没有看到我的 application.yml
文件,该文件位于项目的 /src/main/resources/database
路径中.
有什么想法吗?
应用程序.yml:
spring:
jpa:
database: mysql
show-sql: true
hibernate:
ddl-auto: update
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/map
username: root
password: abcd
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/>
</parent>
<groupId>example.com</groupId>
<artifactId>geo-informer</artifactId>
<version>1.0</version>
<name>Geo Informer</name>
<description>
The Spring Boot app, which makes interaction with the OpenStreetmap Nominatim API
to work with geographic data and store it to the MySQL database
</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- MySQL Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Spring Boot Maven plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
这个项目位于这里:
https://github.com/OlegSandro/geo-informer/tree/dev
最佳答案
因为 application.yml
没有直接存储在 src/main/resources
中,所以它没有被加载。
在您的EntryPoint.java
文件中,您可以添加@PropertySource
注释并提供您的application.yml 的路径,或者您应该将文件直接存储在resources 文件夹下.
关于java - Spring Boot项目看不到数据库连接的数据,写在application.yml中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58183159/
我已经成功创建了我的第一个 django 项目。 我的项目 foo 和 foobar 中有两个应用程序。 我在每个应用程序文件夹中创建了一个名为“fixtures”的文件夹。我没有在我的setting
我遵循了 cap + nginx + unicorn 上的文档,但在理解如何正确进行数据库部署时遇到了一些问题。 /config/database.yml 不应该在 git repo 中(最好) 在/
GitLab server can't start .原因很可能是 gitlab.yml 配置文件不正确。 用什么工具检查yml语法是否正确? 我试过 Notepad++ 和 SublimeText,
我们有一个站点范围的 config.yml 文件,它联系 api key 等... 我的另一个 YML 文件能否访问 config.yml 中的值? 配置文件: development: th
我正在尝试在我的第一个测试应用程序中设置用户和安全管理,但我已经有点迷失了,不知道什么是做什么的。 到目前为止我的设置:Symfony 2.5、SonataUserBundle(以及 FOSUserB
我需要在 application.yml 中使用 yaml anchor 引用和字符串连接对于 Spring Boot 应用程序。动机是重用现有配置而不是复制它们。例如,我们有以下 applicati
我需要将单个 YML 文件拆分为多个 YML 文件: 微服务.yml: #------------------------------------------------------------- #
在我的 Symfony2 config.yml 文件中,我想导入一些我希望收集在单独的 yml 文件中的配置。 我用过: imports: - { resource: parameters.yml }
我是新的 docker 用户。在不同的手册中,我通常发现 docker-compose.yml 文件用于描述 docker 作业,但在 docker 站点上为此目标使用了 docker-stack.y
我不明白这两种在 Symfony2 中设置全局常量的方法之间的区别。是否只能在 config.yml (+configuration.php) 中设置默认值和类型? 最佳答案 参数.yml 文件是所有
在 config.yml 中,我看到了 monolog、web_profiler 等根元素。那些服务可以在 service.yml 中配置吗?换句话说,我在 service.yml 中定义的服务是否可
我阅读了这个文档:https://serverless.com/framework/docs/providers/google/guide/services/ users/ serverless.
我正在从事 CI/CD 项目(使用 circleci 管道),目前,我坚持让我的“create_infrastructure”工作正常工作。下面是作业 # AWS infrastructure
编辑:原始标题“文本环境:”平台“sqlite”不支持函数“year”” 将 beberlei\DoctrineExtensions 合并到测试环境中会产生 Uncaught PHP Exceptio
abc.yml: d_lab: 192.168.1.1 d_location: /ephemeral ema: apple: 10.0.0.1 orange: 10.0.0.2
我的 springboot 应用程序有一些 yml 文件(每个文件用于各种配置文件 - dev、prod)来加载配置。我正在将配置移至数据库。 示例配置如下: admin: id: user05
我有一个大型剧本,它使用多个角色来设置新服务器。我想重新使用剧本,但为了退役阶段而不是调用 role_name/tasks/main.yml 并有很多 when: 语句,我想要告诉 Ansible 调
使用 bookdown 创作文档时,我知道有四个选项可以放置配置选项: _bookdown.yml _output.yml 第一个 .Rmd 的 yaml header 文档 传递给 bookdown
我们希望将我们的 azure pipeline build .ymls 模块化。对于完整的应用程序构建,将包括不同组件的构建 .yml 到主 .yml 中,将它们全部构建在一起。对于单独的组件,我们将
假设我的网站上有一个简单的传统联系表单,我希望它在发送电子邮件时在开发环境中使用主题“Test: (subject_field value)”,在生产环境中使用“(subject_field_valu
我是一名优秀的程序员,十分优秀!