refactor: use Spring DI for MapStruct and update AGENTS.md rule
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
## 개발 가이드라인
|
## 개발 가이드라인
|
||||||
* 패키지명은 `controller` 대신 `presentation`을 사용합니다.
|
* 패키지명은 `controller` 대신 `presentation`을 사용합니다.
|
||||||
* MapStruct 사용 시, 테스트 환경 에러를 방지하기 위해 생성자(`new ...Impl()`) 대신 `Mappers.getMapper(인터페이스명.class)` 방식으로 인스턴스를 가져옵니다.
|
* MapStruct 사용 시, Spring DI를 활용하여 의존성 주입(`private final Converter converter;`)을 받는 방식을 권장합니다. (단위 테스트 시에는 `@MockBean` 또는 직접 구현체를 주입하여 테스트)
|
||||||
|
|
||||||
## 명심해야 할 규칙 추가란
|
## 명심해야 할 규칙 추가란
|
||||||
* 이모지는 무조건 넣지 않는다
|
* 이모지는 무조건 넣지 않는다
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ public class ToolScaffolder {
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import %s.converter.%sLegacyConverter;
|
import %s.converter.%sLegacyConverter;
|
||||||
import %s.legacy.%sLegacyReq;
|
import %s.legacy.%sLegacyReq;
|
||||||
|
|
||||||
@@ -210,7 +209,7 @@ public class ToolScaffolder {
|
|||||||
public class %sService {
|
public class %sService {
|
||||||
|
|
||||||
private final AxhubMciComponent mci;
|
private final AxhubMciComponent mci;
|
||||||
private final %sLegacyConverter converter = Mappers.getMapper(%sLegacyConverter.class);
|
private final %sLegacyConverter converter;
|
||||||
|
|
||||||
@McpFunction(
|
@McpFunction(
|
||||||
displayName = "%s 툴",
|
displayName = "%s 툴",
|
||||||
@@ -255,7 +254,7 @@ public class ToolScaffolder {
|
|||||||
createDate, author,
|
createDate, author,
|
||||||
routingType, group.toLowerCase(),
|
routingType, group.toLowerCase(),
|
||||||
baseName,
|
baseName,
|
||||||
baseName, baseName,
|
baseName,
|
||||||
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
||||||
baseName,
|
baseName,
|
||||||
baseName,
|
baseName,
|
||||||
@@ -272,7 +271,6 @@ public class ToolScaffolder {
|
|||||||
import %s.dto.%sRes;
|
import %s.dto.%sRes;
|
||||||
import %s.converter.%sLegacyConverter;
|
import %s.converter.%sLegacyConverter;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package %s.service
|
* @package %s.service
|
||||||
@@ -293,9 +291,10 @@ public class ToolScaffolder {
|
|||||||
routingType = "%s",
|
routingType = "%s",
|
||||||
categoryKey = "%s"
|
categoryKey = "%s"
|
||||||
)
|
)
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class %sService extends AbstractMcpToolService {
|
public class %sService extends AbstractMcpToolService {
|
||||||
|
|
||||||
private final %sLegacyConverter converter = Mappers.getMapper(%sLegacyConverter.class);
|
private final %sLegacyConverter converter;
|
||||||
|
|
||||||
@McpFunction(
|
@McpFunction(
|
||||||
displayName = "%s 툴",
|
displayName = "%s 툴",
|
||||||
@@ -324,7 +323,7 @@ public class ToolScaffolder {
|
|||||||
createDate, author,
|
createDate, author,
|
||||||
routingType, group.toLowerCase(),
|
routingType, group.toLowerCase(),
|
||||||
baseName,
|
baseName,
|
||||||
baseName, baseName,
|
baseName,
|
||||||
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
||||||
baseName,
|
baseName,
|
||||||
baseName,
|
baseName,
|
||||||
|
|||||||
Reference in New Issue
Block a user