如果一个十来年的ssh项目想使用springboot的便捷性,但又不想从零开始,那么就让我们开始迁移吧。
在pom文件添加springboot 依赖
创建application 启动类
迁移web.xml
web.xml文件中定义了filter, struts2等等一堆filter, 这时我们需要做的一件事是在springboot中使我们的filter, struts2 能正常work。 这样就不需要我们改变项目中已经定义好的大量的action、controller层代码.
//声明当前类为一个配置类
@Configuration
//自动扫描包路径
@ComponentScan({"com.demo.action", "com.demo.util","com.demo.security"})
//引入之前已经存在的配置文件
@ImportResource(locations = {
"classpath:applicationContext-configuration.xml",
"classpath:applicationContext-orm.xml",
"classpath:applicationContext-business.xml",
"classpath:ApplicationContext-RabbitMQ.xml",
"classpath:applicationContext-security-authorization.xml",
})
public class ApplicationConfig {
private stati