Issue
I am a Java newbie and learning frameworks through the document. I am wondering how can I distinguish which framework is being used? Is it in pom.xml
? or spring.xml
?
If it is, what tags are used?
Thanks!
Solution
Answering which framework is being used? it's hard to know tbh sometimes
what if is an old app? does it have a pom.xml file? I would ask somethings like
is it a web app? yes does it contain a web.xml? yes check the web.xml maybe there is defined jersey, spring, what version of servlets is uising etc...
does the app has pom.xml? yes review all the dependencies they have
Sometimes I've seen web.xml and pom.xml using many things pffff.
Now speaking just about spring, it's easier if your project uses the annotation:
@SpringBootApplication
It is a SpringBoot app. This annotation should be in the main of the app the class could be named something like XXXXXApplication
and should look like
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class XXXXXApplication {
public static void main(String[] args) {
SpringApplication.run(StackoverflowApplication.class, args);
}
}
there you got it is a SpringBoot app for sure just check the POM.xml and see what starters are example:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
this will add all the dependencies in order to create a controller, service, it will add a run time tomcat etc...
if you want to know more of the starters read here: https://www.javatpoint.com/spring-boot-starters
if you do not see the annotation @SpringBootApplication but it could be using spring, just review the pom file and try to find some spring deendencies or if it is an old app maybe you will see a file called springApplicationContext.xml or beans.xml anyway hope you deal with a SpringBoot app is easier
Answered By - Yussef