Error: java.lang.IllegalArgumentException: No visible constructors in class org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar$DefaultObjectMapperCustomizer
Mostly, I used example given in link, and the following code can be found at github repository
Annotation:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface NeedTestClass {
}
Aspect:
@After("@args(NeedTestClass)")
public void afterReturningAtArgs() {
log.info("aspect: after @args {}");
}
Service:
@Slf4j
@Component
public class BusinessService {
public void logicWithAnnotatedArgs1(Child c) {
log.info("service");
}
}
Pojo (top class, not sub class):
@NoArgsConstructor // tried with or without
@NeedTestClass
public class Child {}
Test:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@WebAppConfiguration
@SpringBootTest
public class AopTest {
@Autowired
private BusinessService myBusinessService;
@Test
public void testAtArgsPCD() {
myBusinessService.logicWithAnnotatedArgs1(new Child());
}
I attempted to examine aop and annotated class inheritance, but it seems the first step could not be ok. I have tried @annotation() and this() PCD both ok.
EDIT: So far I am wondering maybe the error is related with the bean loading sequence.