Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework
this week in the
Java in General
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Spring
@Qualifier and @Autowired object coming as null
Jacob Leo
Greenhorn
Posts: 1
posted 4 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
My code is like below
@Builder(toBuilder = true) @AllArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE) @ToString @EqualsAndHashCode @Configurable public class Employee { @Autowired @Qualifier("findEmpByDepartment") private Function<Long, Long> empByDepartment; private void save() { this.empByDepartment.getList(); } }
And FindEmpByDepartment class looks like.
@Component("findEmpByDepartment") public class FindEmpByDepartment implements Function<Long, Long> { //some thing }
My problem is I am always getting null when invoke below line
this.empByDepartment.getList();
Here
this.empByDepartment
is coming as null. Any idea why it is like this?
Thanks
Rob Spoor
Sheriff
Posts: 22817
132
I like...
posted 4 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to the Ranch!
If you check at
@Configurable
, you'll see that the default value for
autowire
is
NO
. Try setting that to
BY_NAME
.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Grouping List Based On Custom Object & Variable
How to join Multiple table using hibernate criteria where entity relationship is not direct ?
Hibernate 4.3 always returns first row in native query
Why is my CrudRepository<T,Long>, QuerydslPredicateExecutor<T> interface do not generate the Bean ?
How to display class level validation error in thymeleaf (not field)
More...