我正在服务器上的Spring Boot上工作,并在前端使用MySQL做出反应。
启动应用程序时,出现以下错误。
此问题有任何指针吗?
申请无法开始
说明:
无法配置数据源:未指定'url'属性,并且无法配置任何嵌入式数据源。
原因:无法确定合适的驱动程序类别
操作:
请考虑以下内容: 如果要使用嵌入式数据库(H2,HSQL或Derby),请将其放在类路径中。 如果您要从特定配置文件加载数据库设置,则可能需要激活它(当前没有配置文件处于活动状态)。
以退出代码1完成的过程
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>
<groupId>fr.alexisvachard</groupId>
<artifactId>authentication-poc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>authentication-poc</name>
<description>JWT Authentication poc</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<jjwt.version>0.9.1</jjwt.version>
<swagger.version>2.9.2</swagger.version>
<swagger-ui.version>2.9.2</swagger-ui.version>
<aerogear-otp-java.version>1.0.0</aerogear-otp-java.version>
<zxing-core.version>3.3.3</zxing-core.version>
<zxing-javase.version>3.3.3</zxing-javase.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>com.warrenstrange</groupId>
<artifactId>googleauth</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>${zxing-core.version}</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>${zxing-javase.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger-ui.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
application-dev.properties
#-Dspring.profiles.active=dev
### SERVER PROPERTIES
server.address=localhost
server.port=8080
### SPRING DATASOURCE PROPERTIES
spring.datasource.url=jdbc:mysql://localhost:3306/blog
spring.datasource.username=root
spring.datasource.password=123
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
### HIBERNATE PROPERTIES
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = update
### JACKSON PROPERTIES
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
spring.jackson.date-format=dd-MM-yyyy
### LOG PROPERTIES
logging.level.fr.alexisvachard.authenticationpoc=TRACE
logging.file=authentication-poc.log
### APPLICATION PROPERTIES
fr.alexisvachard.authentication-poc.app.front.host=http://localhost:3000
fr.alexisvachard.authentication-poc.jwt.secret=
fr.alexisvachard.authentication-poc.jwt.expirationInMs=604800000
fr.alexisvachard.authentication-poc.jwt.rememberMeExpirationInMs=2592000000
fr.alexisvachard.authentication-poc.cors.maxAge=3600
fr.alexisvachard.authentication-poc.email.from=
fr.alexisvachard.authentication-poc.email.template-base-package=/mailTemplate
### EMAIL PROPERTIES
spring.mail.host=
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.transport.protocol=
spring.mail.properties.mail.smtp.port=
spring.mail.properties.mail.smtp.auth=
spring.mail.properties.mail.smtp.starttls.enable=
spring.mail.properties.mail.smtp.starttls.required=
spring.mail.properties.mail.smtp.ssl.trust=
spring.mail.default-encoding=UTF-8
spring.mail.port=
## ACTUATOR SETTINGS
management.endpoints.enabled-by-default=false
management.endpoint.health.enabled=true
management.endpoint.httptrace.enabled=true
management.endpoint.metrics.enabled=true
management.endpoints.web.base-path=/manage
management.endpoint.health.roles=ROLE_ADMIN
management.endpoint.health.show-details=when_authorized
management.endpoints.web.cors.allowed-origins=*
management.endpoints.web.cors.max-age=3600s
management.endpoints.web.cors.allowed-headers=*
management.endpoints.web.cors.allowed-methods=GET
management.endpoints.web.exposure.include=health, httptrace, metrics
application-prod.properties
#-Dspring.profiles.active=prod
### SERVER PROPERTIES
server.address=localhost
server.port=8080
### SPRING DATASOURCE PROPERTIES
spring.datasource.url=jdbc:mysql://localhost:3306/blog
spring.datasource.username=root
spring.datasource.password=123
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
### HIBERNATE PROPERTIES
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = update
### JACKSON PROPERTIES
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
spring.jackson.date-format=dd-MM-yyyy
### LOG PROPERTIES
logging.level.fr.alexisvachard.authenticationpoc=TRACE
logging.file=authentication-poc.log
### APPLICATION PROPERTIES
fr.alexisvachard.authentication-poc.app.front.host=http://localhost:3000
fr.alexisvachard.authentication-poc.jwt.secret=
fr.alexisvachard.authentication-poc.jwt.expirationInMs=604800000
fr.alexisvachard.authentication-poc.jwt.rememberMeExpirationInMs=2592000000
fr.alexisvachard.authentication-poc.cors.maxAge=3600
fr.alexisvachard.authentication-poc.email.from=
fr.alexisvachard.authentication-poc.email.template-base-package=/mailTemplate
### EMAIL PROPERTIES
spring.mail.host=
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.transport.protocol=
spring.mail.properties.mail.smtp.port=
spring.mail.properties.mail.smtp.auth=
spring.mail.properties.mail.smtp.starttls.enable=
spring.mail.properties.mail.smtp.starttls.required=
spring.mail.properties.mail.smtp.ssl.trust=
spring.mail.default-encoding=UTF-8
spring.mail.port=
## ACTUATOR SETTINGS
management.endpoints.enabled-by-default=false
management.endpoint.health.enabled=true
management.endpoint.httptrace.enabled=true
management.endpoint.metrics.enabled=true
management.endpoints.web.base-path=/manage
management.endpoint.health.roles=ROLE_ADMIN
management.endpoint.health.show-details=when_authorized
management.endpoints.web.cors.allowed-origins=*
management.endpoints.web.cors.max-age=3600s
management.endpoints.web.cors.allowed-headers=*
management.endpoints.web.cors.allowed-methods=GET
management.endpoints.web.exposure.include=health, httptrace, metrics
答案 0 :(得分:0)
您使用什么命令来运行应用程序?
我注意到您有两个配置文件:dev和prod。
如果您没有配置文件运行该应用程序,则Spring Boot会默认“查找”,看来您没有默认的属性文件。