init source

This commit is contained in:
leejisun9
2025-08-08 13:26:09 +09:00
parent 795fe1754d
commit a21d9909ec
22 changed files with 694 additions and 18 deletions

View File

@@ -0,0 +1,13 @@
package com.bio.bio_backend;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BioBackendApplication {
public static void main(String[] args) {
SpringApplication.run(BioBackendApplication.class, args);
}
}

View File

@@ -0,0 +1,13 @@
package com.bio.bio_backend;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(BioBackendApplication.class);
}
}

View File

@@ -0,0 +1,34 @@
package com.bio.bio_backend.controller;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bio.bio_backend.entity.Test;
import com.bio.bio_backend.repository.TestRepository;
@RestController
@RequestMapping("/api/test")
public class TestController {
private final TestRepository repository;
public TestController(TestRepository repository){
this.repository = repository;
}
@GetMapping
public List<Test> getAllUsers(){
System.out.println("test10099!!");
return repository.findAll();
}
@PostMapping
public Test creatTest(@RequestBody Test test){
return repository.save(test);
}
}

View File

@@ -0,0 +1,19 @@
package com.bio.bio_backend.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Test {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private String email;
}

View File

@@ -0,0 +1,9 @@
package com.bio.bio_backend.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.bio.bio_backend.entity.Test;
public interface TestRepository extends JpaRepository<Test,Long>{
}

View File

@@ -0,0 +1,34 @@
server.port=8080
server.servlet.context-path=/service
spring.application.name=bio_backend
spring.devtools.livereload.enabled=true
#spring.devtools.restart.poll-interval=2000
# 추가로 감시할 경로 (자바 소스 폴더)
spring.devtools.restart.additional-paths=src/main/java
# 데이터베이스 연결 정보
# URL 형식: jdbc:postgresql://[호스트명]:[포트번호]/[데이터베이스명]
spring.datasource.url=jdbc:postgresql://stam.kr:15432/mms
spring.datasource.username=mms_user
spring.datasource.password=tam1201
spring.datasource.driver-class-name=org.postgresql.Driver
# JPA/Hibernate 설정
# ddl-auto: 엔티티(Entity)에 맞춰 데이터베이스 스키마를 자동 생성/업데이트합니다.
# - create: 애플리케이션 시작 시 기존 스키마를 삭제하고 새로 생성 (개발용)
# - create-drop: 시작 시 생성, 종료 시 삭제 (테스트용)
# - update: 엔티티 변경 시 스키마 업데이트 (개발용)
# - validate: 엔티티와 스키마 일치 여부만 검증 (운영용)
# - none: 아무 작업도 하지 않음
spring.jpa.hibernate.ddl-auto=update
# SQL 쿼리를 콘솔에 표시
spring.jpa.show-sql=true
# Hibernate가 SQL을 포맷하여 보여줌
spring.jpa.properties.hibernate.format_sql=true
# HikariCP 연결 풀 크기 설정 (선택사항)
# spring.datasource.hikari.maximum-pool-size=10

View File

@@ -0,0 +1,11 @@
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>테스트</title>
</head>
<body>
테스트400
</body>
</html>

View File

@@ -0,0 +1,13 @@
package com.bio.bio_backend;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BioBackendApplicationTests {
@Test
void contextLoads() {
}
}