Вот мой код, в котором я хочу создать вызов
Код: Выделить всё
@PostMapping(value = "/registerSendRequest", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity registerRequest(@RequestBody Map info) {
Optional possibleUser = userService.check(info.get("username"));
AlreadyExistsResponse response;
if (possibleUser.isPresent()) {
response = new AlreadyExistsResponse(true);
return new ResponseEntity(response, HttpStatus.OK);
} else {
response = new AlreadyExistsResponse(false);
return new ResponseEntity(response, HttpStatus.OK);
}
}
Код: Выделить всё
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.2'
id 'io.spring.dependency-management' version '1.1.4'
}
group = 'com.project'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.projectlombok:lombok'
implementation('org.springframework.boot:spring-boot-starter-mail')
compileOnly 'org.springframework:spring-context-support'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'mysql:mysql-connector-java'
runtimeOnly 'org.apache.activemq:artemis-jakarta-server'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
Код: Выделить всё
server:
port: 8080
spring:
mail:
properties:
"[mail.smtp.connectiontimeout]": 5000
"[mail.smtp.timeout]": 3000
"[mail.smtp.writetimeout]": 5000
application:
name: book-service
h2:
console:
enabled: true
settings:
web-allow-others: true
path: /h2-console
datasource:
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: update
show-sql: true
Одна вещь, с которой я действительно борюсь, - это то, какие фактические зависимости Springboot использовать и работать с. Я не знаю, связано ли это с недостатком опыта, но документация по Springboot и gradle кажется очень запутанной и большую часть времени ее трудно читать. Особенно при отладке Gradle. Я попробовал использовать пару зависимостей, которые, по моему мнению, больше не действительны и приводят к сбою моего приложения при сборке ./gradlew или gradle. И большинство сообщений о переполнении стека или git, которые я нашел, устарели на много лет и больше не применимы
Подробнее здесь: https://stackoverflow.com/questions/788 ... gradle-pro