You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@SpringBootTest(classes = ...) does not seem to pick classes annotated by JSR-330 @Named if they have a constructor. It works with other spring annotation (@Component, @Service, etc). It works if the class does not have a constructor.
@SpringBootTest(classes = ...) does not seem to pick classes annotated by JSR-330 @nAmed if they have a constructor.
The important missing piece is that the bean is not created if the constructor is not public. I can't see why that would be related to Spring Boot at this point, moving to framework.
snicoll
transferred this issue from spring-projects/spring-boot
Apr 9, 2020
@SpringBootTest(classes = ...)
does not seem to pick classes annotated by JSR-330@Named
if they have a constructor. It works with other spring annotation (@Component
,@Service
, etc). It works if the class does not have a constructor.I am using 2.2.6.RELEASE version.
E.g.
The following test fails
This change to DummyService would make it succeed:
Also the following change to DummyService would make it succeed:
Or you can change your test strategy and it would succeed:
The text was updated successfully, but these errors were encountered: