spring:autowire需要web应用吗?

时间:2014-12-01 22:53:05

标签: java spring

我正在使用如下的autowire:

 @Autowired
    @Required
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

但是错误就像

一样
2014-12-02 06:37:04 DEBUG QuartzSchedulerThread:276 - batch acquisition of 1 triggers
2014-12-02 06:37:04 DEBUG JobRunShell:201 - Calling execute on job ETLConnectorJobGroup_ID16.ETLConnectorJob_ID16
2014-12-02 06:37:04 DEBUG SpringBeanAutowiringSupport:89 - Current WebApplicationContext is not available for processing of ConnectorScheduler: Make sure this class gets constructed in a Spring web application. Proceeding without injection.

Autowired是否需要spring MVC,因为它抱怨WebApplicationContext不可用

更新: 我错误地使用了MVC中的SpringBeanAutowiringSupport,删除后错误消失了。

0 个答案:

没有答案