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.

JestElasticsearchTemplate not able to do AutoWired.

See original GitHub issue

Hi @VanRoy , I tried to autowire the JestElasticsearchTemplate and it is returning below error.

Action: Consider defining a bean of type ‘com.github.vanroy.springdata.jest.JestElasticsearchTemplate’ in your configuration.

for code

@Service public class ElasticSearchService { @Autowired private JestElasticsearchTemplate template; }

and dependency I am using is <dependency> <groupId>com.github.vanroy</groupId> <artifactId>spring-boot-starter-data-jest</artifactId> <version>3.3.0.RELEASE</version> </dependency> After checking all beans that is created in my application I did not found any bean for JestElasticsearchTemplate. But I see bean for elasticsearchTemplate is created.

Also when I am not getting any exception when I am autowiring an interface @Autowired private ElasticsearchOperations template;

and after the getting class of above template class variable I can see it is pointing to JestElasticsearchTemplate class, but again after this I checked all beans which is created in Container I did not found JestElasticsearchTemplate bean is created.

It all looks strange to me as

  1. Error is throwing for JestElasticsearchTemplate while performing autowiring on that.
  2. How in my container I did not found any bean name as JestElasticsearchTemplate.
  3. And even if there is not any bean created in my container how @Autowired private ElasticsearchOperations template is pointing to JestElasticsearchTemplate class.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
VanRoycommented, Nov 1, 2020

Hi @sats17, Indeed it’s really strange 😄 . I will investigate on it.

0reactions
sats17commented, Dec 5, 2020

Hi @VanRoy ,

Thanks for the clarification 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot not autowiring class in test - java - Stack Overflow
I think I would not use D.I. at all for my tests but just instantiate any helpers as fields or in a @Before...
Read more >
ElasticsearchTemplate is not injected. · Issue #98 - GitHub
A doubt: is it possible for the ElasticsearchTemplate object to be injected? @RestController @RequestMapping("/user") public class UserResource ...
Read more >
Java: How to fix Spring @Autowired annotation not working ...
In this blog I'll explain the issues and possible solutions. Do note that since I do not have a long history with Spring,...
Read more >
Why are my autowired fields null - Marten Deinum
Instance of bean not visible to Spring. For Spring to be able to do dependency injection it needs to know about the beans...
Read more >
Wiring in Spring: @Autowired, @Resource and @Inject
Using Lightrun, you can drill down into running applications, including 3rd party dependencies, with real-time logs, snapshots, and metrics. No ...
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