🔄Update: [T1] 初始化后端
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package cn.hezhaohui.chatbox;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("cn.hezhaohui.chatbox.mapper")
|
||||
public class Application {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.hezhaohui.chatbox.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@Configuration
|
||||
public class GsonConfig {
|
||||
|
||||
@Bean
|
||||
public HttpMessageConverters customConverters() {
|
||||
Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
|
||||
GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
|
||||
messageConverters.add(gsonHttpMessageConverter);
|
||||
return new HttpMessageConverters(true, messageConverters);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.hezhaohui.chatbox.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "健康")
|
||||
@RequestMapping("/health")
|
||||
public class HealthController {
|
||||
|
||||
@Operation(summary = "健康检查")
|
||||
@GetMapping
|
||||
public ResponseEntity<String> health() {
|
||||
return ResponseEntity.ok("Hello, wonder!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
# springdoc-openapi项目配置
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
api-docs:
|
||||
path: /v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: cn.hezhaohui.chatbox.controller
|
||||
# knife4j的增强配置,不需要增强可以不配
|
||||
knife4j:
|
||||
enable: true
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://47.121.181.112:3306/chat_box
|
||||
username: root
|
||||
password: dn293830
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
security:
|
||||
user:
|
||||
name: wonder
|
||||
password: dn293830
|
||||
Reference in New Issue
Block a user