解决方案 »

  1.   

    之前的项目是执行一些定时任务生成报表,是跑在tomcat容器中的,现在需要把tomcat释放出来,直接改成Java应用,跑定时任务生成报表,项目大体就是这样的,麻烦帮忙看看web.xml里的初始化配置怎么修改?
      

  2.   

    web.xml删掉,建议你用Spring boot 中的CommandLineRunner
    http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-command-line-runner
    直接使用spring 
    new ClassPathXmlApplicationContext("classpath*:*applicationContext*.xml")
    .registerShutdownHook();
    如果作为应用程序,就不需要servlet了。
      

  3.   

    那你该的东西就多啊!以前你要用servlet,现在不用,改的东西就麻烦,
      

  4.   

    场景是这样的:现在有个web工程跑的生成报表的定时任务,现在需要把web工程转化为纯Java工程,转化过程中web工程中的web.xml中的这些 context-param -> listener -> filter -> servlet怎么在Java类中去初始化他们?