diff --git a/src/main/java/com/xit/core/config/_ignore/CustomBeanNameGenerator.java b/src/main/java/com/xit/core/config/_ignore/CustomBeanNameGenerator.java deleted file mode 100644 index 0271898..0000000 --- a/src/main/java/com/xit/core/config/_ignore/CustomBeanNameGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.xit.core.config._ignore; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.beans.factory.support.BeanNameGenerator; -import org.springframework.context.annotation.AnnotationBeanNameGenerator; -import org.springframework.lang.NonNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * 패키지 이름이 다른데, 클래스 이름이 동일한 경우 - * 두 개의 클래스 모두 빈으로 등록 - * - * 특정 어노테이션을 가진 클래스만 패키지 이름까지 포함하여 빈 등록 시에 이름을 구분할 수 있도록 한다. - * - * /v1/api, /v2/api 형태로 생성 가능하도록 - */ -public class CustomBeanNameGenerator implements BeanNameGenerator { - - /** - * basePackages 외에 scaning된 beanGenerator - */ - private static final BeanNameGenerator DELEGATE = new AnnotationBeanNameGenerator(); - - /** - * VersioningBeanNameGenerator 대상 package 경로 - */ - private final List basePackages = new ArrayList<>( - Arrays.asList("com.xit.biz", "com.xit.core") - ); - - @Override - public @NonNull String generateBeanName(@NonNull BeanDefinition definition, @NonNull BeanDefinitionRegistry registry) { - if(isTargetPackageBean(definition)) { - return getBeanName(definition); - } - - return DELEGATE.generateBeanName(definition, registry); - } - - private boolean isTargetPackageBean(BeanDefinition definition) { - String beanClassName = getBeanName(definition); - return basePackages.stream().anyMatch(beanClassName::startsWith); - } - - private String getBeanName(BeanDefinition definition) { - return definition.getBeanClassName(); - } - - public void addBasePackages(String path) { - this.basePackages.add(path); - } -} \ No newline at end of file diff --git a/src/main/java/com/xit/core/config/_ignore/CustomBeanNameGenerator2.java b/src/main/java/com/xit/core/config/_ignore/CustomBeanNameGenerator2.java deleted file mode 100644 index bf0c814..0000000 --- a/src/main/java/com/xit/core/config/_ignore/CustomBeanNameGenerator2.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.xit.core.config._ignore; - -import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.beans.factory.support.BeanNameGenerator; -import org.springframework.context.annotation.AnnotationBeanNameGenerator; -import org.springframework.lang.NonNull; -import org.springframework.stereotype.Service; - -import java.util.Set; - -/** - *
- * 패키지 이름이 다른데, 클래스 이름이 동일한 경우
- * 두 개의 클래스 모두 빈으로 등록
- *
- * 특정 어노테이션을 가진 클래스만 패키지 이름까지 포함하여 빈 등록 시에 이름을 구분할 수 있도록 한다.
- *
- * /v1/api, /v2/api 형태로 생성 가능하도록
- * 
- */ -public class CustomBeanNameGenerator2 implements BeanNameGenerator { - - private final AnnotationBeanNameGenerator defaultNameGenerator = new AnnotationBeanNameGenerator(); - - @Override - public @NonNull String generateBeanName(@NonNull BeanDefinition definition, @NonNull BeanDefinitionRegistry registry) { - String beanName; - - if (isService(definition)) { - beanName = getFullName((AnnotatedBeanDefinition) definition); - } else { - beanName = defaultNameGenerator.generateBeanName(definition, registry); - } - return beanName; - } - - private String getFullName(final AnnotatedBeanDefinition definition) { - // 패키지를 포함한 전체 이름을 반환한다. - return definition.getMetadata().getClassName(); - } - - private boolean isService(final BeanDefinition definition) { - if (definition instanceof AnnotatedBeanDefinition) { - final Set annotationTypes = ((AnnotatedBeanDefinition) definition).getMetadata() - .getAnnotationTypes(); - - return annotationTypes.stream() - .anyMatch(type -> type.equals(Service.class.getName())); - } - return false; - } -} \ No newline at end of file diff --git a/src/main/resources/config/conf.yml b/src/main/resources/config/conf.yml index 2f77382..3d295c9 100644 --- a/src/main/resources/config/conf.yml +++ b/src/main/resources/config/conf.yml @@ -17,7 +17,7 @@ api: file: cmm: upload: - root: /data/file/upload + root: c:/data/file/upload # root: /Users/minuk/data/file/upload # 공지사항 path: /kangnamSIM/simUpFile