Some Spring 5 types should be hidden
See original GitHub issueI’m using the last 3.0 snapshot and I’ve and endpoint like this:
@GetMapping(path = "/loggedAgent")
public ResponseEntity<?> loggedAgent(Locale locale, PersistentEntityResourceAssembler resourceAssembler) {
CustomUserDetail loggedUser = SecurityUtils.getLoggedUser();
Agent loggedAgent = agentRepository.findByUsername(loggedUser.getUsername());
if (loggedAgent != null)
return new ResponseEntity<>(resourceAssembler.toResource(loggedAgent), HttpStatus.OK);
throw new ResourceNotFoundException(ExceptionCode.RESOURCE_NOT_FOUND, "");
}
In my application I’m using Spring (Spring MVC, Spring Data REST); locale
and resourceAssembler
are two parameters injected by Spring and they should not be displayed in Swagger.
Instead I see this.
If the method has some real addition parameter, then locale
and resourceAssembler
are not displayed anymore.
As mentioned here a temporary solution is to call .ignoredParameterTypes(Locale .class, PersistentEntityResourceAssembler .class)
from the Docket
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Top 10 Most Common Spring Framework Mistakes - Toptal
Top 10 Most Common Spring Framework Mistakes · Avoid Global State. First, always remember the “global state” issue. · Avoid Mutability. This one...
Read more >Spring Framework 5: Hidden Gems - InfoQ
Jüergen Hoeller highlights some of the personal favorites newbies beyond the major themes in Spring Framework 5.
Read more >Spring MVC - Hidden Field Example - Tutorialspoint
Spring MVC - Hidden Field Example, The following example describes how to use a Hidden Field in forms using the Spring Web MVC...
Read more >Best Practices for Dependency Injection with Spring
In this post, I'm going to show you how to use Project Lombok for best practices in dependency injection with the Spring Framework....
Read more >Field injection is not recommended – Spring IOC - Marc Nuri
This post shows the different types of injections available in Spring ... You can even see this injection method on some of Spring...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also remember about
AuthenticationPrincipal.class
andServerWebExchange.class
This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.