I have been trying to start a simple Spring project as a part of my study. From the tutorials (they are about a year old resources i am refering), it seems the Spring related libraries were easily available online then. But now; I was unable to get something like a "spring_ver_no.zip" from the spring source site. It is having options to download a tool suite which is about 350 MBs large.
Can you please guide me if that download is the way to setup a Spring development environment?If not what is the way to set up a simple Spring environment in eclipse.
Thanks
Angie
You should use a dependency management tool like Gradle or Maven, and let this tool download the libraries for you. See the quick start for how to include Spring in your dependencies. If you still want to download the jar files and add them manually to your project, then download them directly from the Maven central repository: http://search.maven.org/#search|ga|1|g%3A%22org.springframework%22
Spring is, for a long time, splitted in several modules. You have to download all the modules you need.
Spring is using Maven lately. You should use it too. Maven is a build tool and dependency manager that will ease your life.
Related
Can someone name me one mini framework in Java that will allow me to build a REST API? The thing is that all need maven installation or Gradle or something similar, but I need something that will "play" with a very simpler installation like installing just a jar or something similar.
Maven and Gradle are project management tools .Developers use them mostly to manage dependencies , but there is no any hard rule saying you must use it compulsory.So if you don't want to use them , you can neglect them ,but then as you asked you need to add all those JAR files externally by searching them through the internet or mostly in maven central repository.Best option would be spring boot application but if you don't like to use maven then I suggest you to go with Spring framework ,but then you should add all those JAR files manually.As an alternative JAX-RS + Jersy will also be fine .
Our group wanna reconstruct our old Spring project into Spring Cloud
and several Spring Boot projects.
And what bothers us is that we cannot connect to Internet for some classified & security reasons. We can only download the dependencies at home and take them to our office (this process is very complicate and takes a long time).
I have read some maven document in apache website, and got the conclusion that we can't download the whole maven respository. It is almost impossible for us to download the jars on maven respository one-by-one because they are so many.
For now, we have setup a nexus server and spring boot initializr, all the problem for now is the maven repository.
Therefore, I wonder if this method is OK or not? Should we quit or is there any other ways?
If you've read this, Thanks.
—— An off-line old school programmer
You can download all spring framework jars as songle zip according to required spring release here
I would suggest you to then upload them to a private repository like Nexus/jfrog and configure all of your Maven/Gradle projects to use this as repository rather than the public repository, This way you don't need access to internet to download dependencies.
You can download all maven dependencies on nexus server and you have to connect your maven repositories with nexus server for that you just have to provide the configuration in setting.xml(will consist of nexus url) file and have to put xml file in .m2 folder of maven and provide the path in eclipse maven user settings and when you will clean and install the project in eclipse it will automatically download all dependencies from nexus server.
please let me know for more details.
Today, i donwloaded Spring Framework 4.0.6 latest version but unable to locate the jar files, and i donwloaded eclipse plugin for spring too, here i find nothing and looking for a way to include these jar files into eclipse, here is a pic.
Some tutorials website refers that it contains into lib folder but i can't see it, please help!
It sounds like you have a number of hurdles to overcome:
How to use Eclipse
How to manage Java dependencies
How to use Spring
I'm not sure what your level of experience is, but you may wish to consider using Spring Tool Suite as your IDE - it's based on Eclipse with additonal plugins to aid Spring development.
I also urge you to use Maven or Gradle to manage your dependencies. The Spring documentation provides the configuration for adding the dependencies in both. I'd recommend Maven as a starting point as it is easy to use with little knowledge and is well suited to small, standard projects. Gradle is worth a look once you are comfortable with Maven.
Work though the Guides - I'd start with 'Building Java Projects with Maven'.
Edit
Maven is a dependency management and build tool that favours convention over configuration. Dependency management is powerful in that you can declare a dependency on Spring Core, for example, and it will download all the related dependencies for you.
Gradle performs similar functions to Maven but also provides the ability to use scripting. Gradle is seen by many as Maven's predecessor and has been adopted by Spring over Maven.
In my opinion Maven is easier for you at this stage.
I always used Hibernate annotations in my old job, but since all our projects were already set up, I never really learned the mechanism behind it.
Could someone please give me a brief outline of how to set everything up, just to get me started?
I am developing in Java using Maven and Oracle 10g Express Edition. My IDE is Eclipse.
I'd recommend starting with the Hibernate tutorial. Basically, you'll need to create a Hibernate configuration file on your classpath (dropping it in src/main/resources works with the default Maven project layout) and then start annotating your data objects. There's a tutorial for Hibernate with XML configuration as well.
The (non-Maven) steps to build a Hibernate project in Eclipse would be:
Step 1: Add the required JARs to setup Hibernate project
Step 2: Add the JARs to the lib folder of your project
Step 3: Additionally, I would suggest you to explore the Hibernate directory structure since you are using it for the first time.
If you need more assistance, I wrote a post on my site http://myjavatrainer.com/setup-hibernate-project/
Hope it will be helpful to you.
Maven is build tool for your projects. Maven is a build tool by Apache, it will help to manage the dependencies better. You will have to install Maven separately and set it up. Read its documentation full and get it setup. Instead of creating a normal Java app or a web app in Eclipse, you will be creating a Maven project.
MAKE SURE YOU ADD A JAR FOR DRIVER CONNECTOR for the type of database you are planning to use through Hibernate.
So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat.
So I setup a new project, configured it to use sun jdk.
I chose a spring application, and it created and downloaded the following:
I don't see any spring-mvc libraries, are they included in there or do I have to do something about that?
Can someone outline what I have to do to get this to build like a spring mvc web application?
I find that the best way to start a new IDEA project is to use the Maven. This allows you to easily build your project without launching the IDE, automatically maintaining all libraries for you.
"Create project from scratch", then select "Maven module" in the next screen. Click on "Create from archetype" and select the "maven-archetype-webapp". This will give you a basic Maven layout which builds a simple WAR file.
Now to add the Spring libraries, open the Maven build file - pom.xml - and insert a new dependency on the Spring MVC framework:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
From here, you can follow the Spring MVC reference documentation - add the Dispatcher Servlet and Context Listener to web.xml, a Spring XML context and so on.
Something else you might find useful is the Maven Jetty plugin. Once configured, you can run your app by simply typing "mvn jetty:run" at the command prompt (or launching it from within the IDE). Maven will fetch all that's required and deploy the app for you, no need for an external app server setup for quick testing.
I'm not sure if your setup would be identical to mine, but when I downloaded spring-framework-2.5.6 there were jar files named spring-web.jar, spring-webmvc.jar, etc. in the \dist\modules subfolders. The tutorial indicated at least spring-webmvc.jar should be in your WEB-INF/lib folder.
This tutorial optionally used eclipse, but might be helpful anyways, especially getting started:
http://static.springsource.org/docs/Spring-MVC-step-by-step/
I think there are specific JARs for the Spring MVC stuff. Basically when you download the latest Spring Framework and you extract the zip you need to go to the dist folder and add the org.springframework.web.jar and org.springframework.web.servlet.jar/org.springframework.portlet.jar to your project. I'm pretty sure that the servlet/portlet jars will have your MVC specific classes.