Spring autowire null pointer exception [duplicate]
问题 This question already has answers here : Why is my Spring @Autowired field null? (16 answers) Closed 2 years ago . xml configuration - <bean id="DS" class="org.springframework.jdbc.datasource.DriverManagerDataSource" > <property name="driverClassName" value="${DB.DRIVERCLASS}" /> <property name="url" value="${TABLEMAINT.URL}" /> <property name="username" value="${TABLEMAINT.USER}" /> <property name="password" value="${TABLEMAINT.PASSWORD}" /> </bean> @Component class AbcDAO{ @Autowired