Я пытаюсь разработать проект с помощью Spring и пытаюсь загрузить для этого «Swagger-ui». Но я всегда сталкиваюсь с проблемами. Ниже я расскажу вам об ошибках, которые я получаю, и поделюсь с вами файлами pom.xml, application.properties и application.java соответственно. Я использую postgresql в качестве базы данных и уверен, что пароль правильный.
***************************
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).
Это лишь одна из ошибок, которые я получаю. Когда я вношу в него некоторые изменения, ошибка может превратиться в вот это.
***************************
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
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.
Я знаю, что между моими папками Spring и кодом, который я написал, есть несоответствие. Но я не знаю, как это исправить, а ChatGPT вообще не помог.
[b]Я пытаюсь разработать проект с помощью Spring и пытаюсь загрузить для этого «Swagger-ui». Но я всегда сталкиваюсь с проблемами. Ниже я расскажу вам об ошибках, которые я получаю, и поделюсь с вами файлами pom.xml, application.properties и application.java соответственно. Я использую postgresql в качестве базы данных и уверен, что пароль правильный.[/b] [code] *************************** 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] [code] *************************** 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:
The calling method's class, org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource, was loaded from the following location:
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 [/code] [b]МОЙ ФАЙЛ pom.xml[/b] [code] xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
@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();
}
} [/code] [b]Затем я решил попробовать что-то другое, решил использовать openapi-ui и добавил следующее в свой файл pom.xml.[/b] [code] org.springdoc springdoc-openapi-ui 1.7.0
[/code] [b]Но на этот раз я столкнулся со следующей ошибкой на порту localhost:8080.[/b] [code]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] [b]Я знаю, что между моими папками Spring и кодом, который я написал, есть несоответствие. Но я не знаю, как это исправить, а ChatGPT вообще не помог.[/b]