Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 调用destroy方法';关闭';对名为';mvcValidator';_Spring_Spring Mvc_Spring Jdbc_Jdbctemplate - Fatal编程技术网

Spring 调用destroy方法';关闭';对名为';mvcValidator';

Spring 调用destroy方法';关闭';对名为';mvcValidator';,spring,spring-mvc,spring-jdbc,jdbctemplate,Spring,Spring Mvc,Spring Jdbc,Jdbctemplate,我正在使用SpringMVC版本3.2.2和JDBC模板。 每当我的tomcat重新发布或重新启动时,在控制台中生成下面的登录 下面给出的三个配置类是基于java的配置 公共类初始值设定项实现WebApplicationInitializer{ @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationCon

我正在使用SpringMVC版本3.2.2和JDBC模板。 每当我的tomcat重新发布或重新启动时,在控制台中生成下面的登录


下面给出的三个配置类是基于java的配置

公共类初始值设定项实现WebApplicationInitializer{

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext();
    webApplicationContext.register(DBConfig.class);
    webApplicationContext.register(WebAppConfig.class);
    webApplicationContext.setServletContext(servletContext);
    ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet("vasculardispatcher", new DispatcherServlet(webApplicationContext));
    dispatcherServlet.setLoadOnStartup(1);
    dispatcherServlet.addMapping("/rootPath/*");
}
}

第二个是

@Configuration
@EnableTransactionManagement
@ComponentScan("com")
public class DBConfig {

    @Bean
    public DataSource getDatasource() {
        //my code for getting datasource
    }

    @Bean
    public JdbcTemplate jdbcTemplate() {
        JdbcTemplate jdbcTemplate = new JdbcTemplate();
        jdbcTemplate.setDataSource(getDatasource());
        return jdbcTemplate;
    }

    @Bean
    public NamedParameterJdbcTemplate namedParameterJdbcTemplate() {
        return new NamedParameterJdbcTemplate(jdbcTemplate());
    }

    @Bean(name=TRANSACTION_MANAGER)
    public PlatformTransactionManager transactionMngr(){
        DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager(getDatasource());
        return dataSourceTransactionManager;
    }   
}
最后一个是

@Configuration
@EnableWebMvc
@ComponentScan("com")
public class WebAppConfig extends WebMvcConfigurerAdapter {

        @Bean
        public UrlBasedViewResolver setupViewResolver() {
                UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
                viewResolver.setOrder(1);
                viewResolver.setPrefix("/jsp/");
                viewResolver.setSuffix(".jsp");
                viewResolver.setViewClass(JstlView.class);
                return viewResolver;
        }

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new SecurityAccessInterceptor());
        }


}

任何帮助都将被告知?

请尝试validation-api-1.0.0.GA


javax.validation
验证api
1.0.0.GA

您使用的是较新的
验证api
版本,而不是实际的验证器实现(可能是
hibernate验证器
)。修复您的依赖关系。
@Configuration
@EnableWebMvc
@ComponentScan("com")
public class WebAppConfig extends WebMvcConfigurerAdapter {

        @Bean
        public UrlBasedViewResolver setupViewResolver() {
                UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
                viewResolver.setOrder(1);
                viewResolver.setPrefix("/jsp/");
                viewResolver.setSuffix(".jsp");
                viewResolver.setViewClass(JstlView.class);
                return viewResolver;
        }

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new SecurityAccessInterceptor());
        }


}