为什么我在这个java动态Web项目中看不到任何主要方法? [英] Why don't I see any main method in this java dynamic web project?

查看:162
本文介绍了为什么我在这个java动态Web项目中看不到任何主要方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解Web服务是如何工作的,而且我遇到了 本教程

I was trying to understand how the Web Services work and I came across this tutorial

现在,我见过spring正在企业应用程序中使用,并且总是想知道主要方法在哪里以及一切如何工作?每当我去Spring教程时,他们将从beanFactory和Contexts开始,然后不是,所有这些都在主java方法中,并且从那里开始按需要继续获取bean。这与我在应用程序中看到的完全不同。

Now, I've seen spring being used in enterprise applications and always wondered where the main method was and how everything worked? And whenever I would go to spring tutorial they'll start with beanFactory and Contexts and what not, all in a main java method and from there just keep getting beans as required. This is totally different from what I see in the applications.

在这种情况下,有人可以告诉我Spring的工作原理是什么。什么是通话顺序。我想在某处会有一些隐藏的主要方法,但我不确定。

Can someone tell me how exactly does spring work in this case. What is the sequence of calls. I guess there will be some hidden main method somewhere but I am not sure of that.

通常如果我从命令行运行一个简单的java项目,我会执行 java mainClass 。现在如何在这种情况下发生。

Normally if I were to run a simple java project from command line, I'd do java mainClass. Now how would it happen in this case.

谢谢

推荐答案

Web应用程序没有main;正在运行的程序实际上是Web容器(Apache Tomcat,Glassfish,JBoss,Weblogic等等),该程序将为您部署到其中的Web应用程序提供服务。您可能希望阅读JEE教程以了解和了解Java Web环境。

Web applications don't have a main; the 'program' that is running is actually the web container (Apache Tomcat, Glassfish, JBoss, Weblogic, whatever) and that program will service the web application(s) you deploy into it. You might want to read the JEE tutorial to learn and understand what a Java web environment is.

https://docs.oracle.com/javaee/7/tutorial/

这篇关于为什么我在这个java动态Web项目中看不到任何主要方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆