-1

I am developing Spring web application inside a maven project. However, I am able to obtain my .war file with no erors using the mvn clean install, but when I want to run it on apache tomcat I got an error that I can't understand whic says:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.ArrayList' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Why such an error can occcur?? and what is beans? and why we need them??

2 Answers2

1

Understanding beans is fundamental to understanding and using Spring. I would read some guides:

https://spring.io/guides

The error you are getting looks like you are trying to @Autowire an ArrayList somewhere without defining a bean of that type.

Plog
  • 9,164
  • 5
  • 41
  • 66
-1

Read Spring In Action by Craig Walls. There are many examples how you should wire your beans. Also, you can learn much about Spring from that book.

Spasoje Petronijević
  • 1,476
  • 3
  • 13
  • 27
  • -1. Sorry. Answers resulting from personal experience and recommendations of specific tools, frameworks, books... is against rules. – Branislav Lazic Mar 23 '17 at 15:12
  • Okay, thank you for informing me,but in book there is explicit answer to this question(how to wire bean properly). Also, you don't need to read whole book for that. there is one small chapter about wiring. – Spasoje Petronijević Mar 23 '17 at 15:16