如何将基于 java 的注释 spring mvc maven 项目转换为 spring boot?我没有 xml 文件,而是使用了 webconfig 类和 webinitializer 类。我知道如何将基于 xml 的项目转换为 spring boot。你可能会想有什么区别?对我来说不同的是,就像我说我使用了 webconfig 类和 webinitializer,我的 spring mvc maven 项目没有主类。我应该在其中一个类中添加:@SpringbootApplication, SpringApplication.run( ?what class name come here? .class, args);
1 回答
1
我将首先查看Spring Initializr并添加 Web 依赖项。这会生成一个示例项目,它应该可以帮助您继续前进。Spring Boot 有很多约定俗成的编码和注释,它带有学习曲线。Spring Boot 教程
来自 Initializr 的 SpringApplication 示例
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
于 2020-05-10T00:25:36.343 回答