Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore : JpaRepository Method Call할 수 있도록 과정수정 및 테스트 샘플 추가 #11

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Api/src/main/java/picasso/server/api/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;

@Slf4j
@EntityScan("picasso.server.domain")
@ComponentScan("picasso.server.domain")
@SpringBootApplication
@RequiredArgsConstructor
public class Application {
Expand Down
21 changes: 21 additions & 0 deletions Api/src/main/java/picasso/server/api/TestService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package picasso.server.api;

import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import picasso.server.domain.domains.test.Test;
import picasso.server.domain.domains.test.TestRepository;

import java.util.Optional;

@Service
@Transactional
@RequiredArgsConstructor
public class TestService {
private final TestRepository testRepository;


public Optional<Test> test() {
return testRepository.findById(1L);
}
}
2 changes: 1 addition & 1 deletion Domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bootJar.enabled = false
jar.enabled = true

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
api 'org.springframework.boot:spring-boot-starter-data-jpa'
api 'org.springframework.boot:spring-boot-starter-validation'
api 'com.mysql:mysql-connector-j:8.0.33'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ public class Test {

@Column
private String name;

private String param1;
private String param2;
private String param3;
private String param4;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package picasso.server.domain.domains.test;


import org.springframework.data.jpa.repository.JpaRepository;

public interface TestRepository extends JpaRepository<Test, Long> {

}
Loading