Код: Выделить всё
***************************
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).
< /code>
[b] Это только одна из ошибок, которые я получаю. Когда я внесу некоторые изменения в это, ошибка может превратиться в это. [/b]
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource.(AbstractTypeAwareSupport.java:135)
The following method did not exist:
'void org.springframework.util.Assert.notNull(java.lang.Object)'
The calling method's class, org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource, was loaded from the following location:
jar:file:/C:/Users/emirg/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/support/AbstractTypeAwareSupport$BeansOfTypeTargetSource.class
The called method's class, org.springframework.util.Assert, is available from the following locations:
jar:file:/C:/Users/emirg/.m2/repository/org/springframework/spring-core/6.1.12/spring-core-6.1.12.jar!/org/springframework/util/Assert.class
The called method's class hierarchy was loaded from the following locations:
org.springframework.util.Assert: file:/C:/Users/emirg/.m2/repository/org/springframework/spring-core/6.1.12/spring-core-6.1.12.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource and org.springframework.util.Assert
Код: Выделить всё
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.3.3
kodlamaio
northwind
0.0.1-SNAPSHOT
northwind
Demo project for Spring Boot
17
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
runtime
true
org.postgresql
postgresql
runtime
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
io.springfox
springfox-swagger2
2.9.2
io.springfox
springfox-swagger-ui
2.9.2
org.springframework.boot
spring-boot-maven-plugin
org.projectlombok
lombok
Код: Выделить всё
spring.application.name=northwind
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/Northwind
spring.datasource.username=*****
spring.datasource.password=*****
spring.jpa.properties.javax.persistence.validation.mode = none
spring.datasource.driver-class-name=org.postgresql.Driver
spring.profiles.active=dev
Код: Выделить всё
package kodlamaio.northwind;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableSwagger2
public class NorthwindApplication {
public static void main(String[] args) {
SpringApplication.run(NorthwindApplication.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("kodlamaio.northwind"))
.build();
}
}
Код: Выделить всё
package kodlamaio.northwind.api.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import kodlamaio.northwind.business.abstracts.ProductService;
import kodlamaio.northwind.entities.concretes.Product;
@RestController
@RequestMapping("/api/products")
public class ProductsController {
@Autowired
public ProductsController(ProductService productService) {
super();
this.productService = productService;
}
private ProductService productService;
@GetMapping("/getall")
public List
getAll(){
return this.productService.getAll();
}
}
Код: Выделить всё
org.springdoc
springdoc-openapi-ui
1.7.0
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sun Sep 01 16:06:17 TRT 2024
There was an unexpected error (type=Not Found, status=404).
No static resource swagger-ui.html.
org.springframework.web.servlet.resource.NoResourceFoundException: No static resource swagger-ui.html.
< /code>
Я знаю, что между моими пружинными папками и кодом, который я написал, существует несоответствие. Но я не знаю, как это исправить, и Chatgpt вообще не помогла.
Подробнее здесь: https://stackoverflow.com/questions/789 ... ith-spring