question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some Spring 5 types should be hidden

See original GitHub issue

I’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.

error

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:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
eximius313commented, Aug 28, 2018

Also remember about AuthenticationPrincipal.class and ServerWebExchange.class

0reactions
stale[bot]commented, Jul 8, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found