[英]Spring Classes not found in eclipse
I am new to spring and i am trying to build a spring application using SpringSource Tool Suite. 我是Spring的新手,我正在尝试使用SpringSource Tool Suite构建spring应用程序。 I installed STS from the .sh file available.
我从可用的.sh文件安装了STS。 I tried to do the following :
我尝试执行以下操作:
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
But eclipse is not able to find these classes. 但是eclipse无法找到这些类。 How do I add this class to eclipse.
如何将此类添加到eclipse。 If I need to import certain JAR's where do i find them?
如果需要导入某些JAR,我在哪里可以找到它们?
They need to be in the CLASSPATH
. 它们必须位于
CLASSPATH
。 That's where Spring looks for .xml
context files when you use the ClassPathXmlApplicationContext
class. 当您使用
ClassPathXmlApplicationContext
类时,Spring就是在其中寻找.xml
上下文文件的地方。
Put JARs, including Spring, in the WEB-INF/lib directory. 将JAR(包括Spring)放在WEB-INF / lib目录中。 If you put your .xml files in the WEB-INF/classes folder they'll be in the CLASSPATH by default.
如果将.xml文件放在WEB-INF / classes文件夹中,则默认情况下它们将位于CLASSPATH中。
here you go: http://www.springsource.org/download . 在这里,您可以访问: http : //www.springsource.org/download 。 First shot at google (
spring download
). 谷歌的第一枪(
spring download
)。
Start with a Spring Template project. 从一个Spring Template项目开始。
New Project/SpringSource Tool Suite/Spring Template Project/
then select one, for example "spring MVC Project". 然后选择一个,例如“ spring MVC Project”。
This projects are maven based, so they will download the needed/specified jars automaticaly. 该项目基于Maven,因此它们将自动下载所需/指定的jar。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.