Я пытаюсь создать библиотеку весенней загрузки с пользовательской аннотацией и Spring AOP. Когда я использовал эту библиотеку с новым весенним загрузочным приложением. Тогда это не работает. Даже я не получаю никакой ошибки.
Образец библиотеки -
Пользовательская аннотация
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface HttpLogger {
}
Spring AOP класс
@Aspect
class LoggingAspect {
@Around("@annotation(com.demo.commonlogging.aspect.HttpLogger)")
public Object inControllers(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
return loggingAdvice(proceedingJoinPoint); // Method for implementation
}
}
pom. xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Использование mvn clean install для создания библиотеки
Теперь новая библиотека импортируется в приложение Springboot.
И новая пользовательская аннотация используется в контроллерах
Контроллеры
@RestController
@RequestMapping(value = "/rest/test")
public class RestApiTestControllers {
@GetMapping
@HttpLogger
public String get(){
return "Hello !";
}
}
Пожалуйста, помогите здесь.