In the springcloud project, the following error occurs when starting:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under ‘spring.datasource.type’ to java.lang.Class<javax.sql.DataSource>:
Property: spring.datasource.type
Value: com.zaxxer.hikari.HikariDataSource
Origin: “spring.datasource.type” from property source “bootstrapProperties-config/application/”
Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class<javax.sql.DataSource>]
Action:
Update your application’s configuration
Disconnected from the target VM, address: ‘127.0.0.1:63170’, transport: ‘socket’
Process finished with exit code 1
Solution: Add the following reference to the pom file
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
Attach POM file
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cloud-plateform-parent</artifactId>
<groupId>org.shr</groupId>
<version>1.0.3.RELEASE</version>
</parent>
<artifactId>aiservice</artifactId>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<!-- http核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
<version>1.12.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.17.3</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.13</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.17.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.3.14</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version>2.2.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-autoconfigure</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.14</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<finalName>shr-centralized-inspect-service</finalName>
<!-- os system information plugin, protobuf-maven-plugin needs to get the system information to download the corresponding protobuf program -->
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<pluginId>grpc-java</pluginId>
<protocArtifact>com.google.protobuf:protoc:3.0.2:exe:${os.detected.classifier}</protocArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.2.0:exe:${os.detected.classifier}</pluginArtifact>
<!-- proto file directory -->
<protoSourceRoot>${project.basedir}/src/main/proto</protoSourceRoot>
<!-- Generated Java files directory -->
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<clearOutputDirectory>false</clearOutputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Read More:
- [Solved] Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
- [Solved] Mybatis Error: CannotFindDataSourceException: dynamic-datasource can not find primary datasource
- Solution to java.lang.IllegalArgumentException: Property’dataSource’ is required
- New Spring boot startup error Failed to auto-configure a DataSource
- [Solved] Springboot Error creating bean with name ‘dataSource’ defined in class path resource
- Java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; error resolution
- How to Fix Error when integrating spring cloud openfeign with spring cloud Alibaba
- [Solved] swagger3 Error: org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
- Gateway Error: Cannot resolve org.springframework.cloud:spring-cloud-starter-gateway:unknown
- [Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘
- [Solved] Spring cloud introduces zuul dependency error
- Win assembleDebug Downloading gradle.zip Error: Exception in thread “main” java.lang.RuntimeException: javax.net.ssl.SSLExce
- JSP error: The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
- Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
- [Solved] java.lang.ClassNotFoundException: org.apache.ibatis.session.SqlSession
- [Solved] Hadoop error java.lang.nosuchmethoderror
- com.alibaba.druid.pool.DruidDataSource error Warning: init datasource error
- How to Solve ERROR – unregister mbean error javax.management.InstanceNotFoundException: com.alibaba.druid:type=
- Hive ERROR Failed with exception java.io.IOException:java.lang.IllegalArgumentException
- SpringBoot startup error Failed to determine a suitable driver class