简体   繁体   English

如何知道一个项目是否是spring boot

[英]How to know if a project is spring boot or not

I went through a project structure in STS where I could see a MVC pattern where controller, service,Dao , entity classes were there.我在 STS 中浏览了一个项目结构,在那里我可以看到一个 MVC 模式,其中控制器、服务、Dao 和实体类都在那里。 But looking at pom.xml got to know that it is a web application project.但是看了pom.xml才知道它是一个web应用项目。 But how to confirm that it is not a spring boot application..?但是如何确认它不是spring boot应用程序..? I m new to spring boot.我是弹簧靴的新手。 All I found is there were no starter dependencies in pom.xml or any dependency has word "boot" & there was not a main method where a spring boot project starts.我所发现的只是 pom.xml 中没有启动器依赖项,或者任何依赖项都带有“boot”字样,并且没有启动 Spring Boot 项目的主要方法。 So my question is which particular dependency/ parameters differentiates spring boot application from a non spring boot application ?所以我的问题是哪些特定的依赖项/参数将 Spring Boot 应用程序与非 Spring Boot 应用程序区分开来?

In general in the first part of the pom.xml you can see this tag:一般来说,在 pom.xml 的第一部分你可以看到这个标签:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
    <relativePath /> 
    <!-- lookup parent from repository -->
</parent>

Check the pom.xml.检查 pom.xml。 see if it includes the spring boot dependency or any other Spring boot dependency flavors like Spring-boot-starter, spring-boot-autoconfigure,spring-boot-web etc.... Basically anything with group ID查看它是否包含 spring boot 依赖项或任何其他 Spring boot 依赖项,如 Spring-boot-starter、spring-boot-autoconfigure、spring-boot-web 等......基本上任何带有组 ID 的东西

"org.springframework.boot" “org.springframework.boot”

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot</artifactId>
    <version>2.3.1.RELEASE</version>
</dependency>

Additionally also look for the @SpringBootApplication annotation on top of the main class.此外,还要在主类的顶部查找 @SpringBootApplication 注释。

If you're running a Gradle project, you might see something like this inside of one of your build.gradle (or [projectName].gradle) files.如果您正在运行 Gradle 项目,您可能会在 build.gradle(或 [projectName].gradle)文件之一中看到类似这样的内容。

    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

Or maybe或者可能

apply plugin: 'org.springframework.boot'

The above advice to search globally for org.springframework.boot is sound, just wanted to stress there might not be a pom.xml (or any .xml ) files present.上面全局搜索org.springframework.boot建议是合理的,只是想强调可能没有pom.xml (或任何.xml )文件存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM