Basic Spring configuration without maven or gradle in eclipse Luna and Mar.

If you wanna build a Java Eclipse Project with Spring configured, here is how you can do that.
It was done with Eclipse Mar and Luna using Spring 4.1.6. After JDK configuration done you must to download all Spring artifacts dependencies manually here, then choose which version you will use, in this case is 4.1.6. download it.
Create a new Java Project in eclipse (right click in Project Explorer -> new -> Project) choose Java -> Java Project, input the Project name and click in finish.

Now we will configure a build Path, it mean, we will make the Spring libraries visibles and usables to the project.
right click in created project -> Build Path – > Configure Build Path. Now you will see this:

SpringPure1

Click in Next.

SpringPure2

Click in User Libraries and then in New

SpringPure3

Enter the User Library Name: SpringLib Spring4.1.6 for example, click in Ok and then select the new User library Spring4.1.6 and click in Add external JAR. Select the directory where you downloaded the Spring artifacts  (for example c:\apis\spring-framework-3.2.0.RELEASE\libs) done in the first step for this tutorial.

SpringPure4

Click in Open (‘Abrir’ in the print). Now you will have this. The SpringFramework works together this the dependences api Commons logging like a Spring4.1.6. You need to do the same steps building the User library Commons-logging. download the jar in commons-logging (commons-logging-1.2-bin.zip).

SpringPure5

Finally we can see a example in the eclipse with two classes Person and SpringTest1, with the beans.xml blue print for Spring. Build your project like this print and run main method for SpringTest1 class.

SpringPure6

Complementing this tutorial is very helpful if you install through Eclipse Marketplace the plugin Eclipse WTP/XML Search after install and restart Eclipse you will be able to, for example, to use autocomplete in xml blueprint Spring configuration xml.

Go to Help -> Eclipse Marketplace. in Find input write ‘wtp xml’, find them. click in install and then reboot Eclipse. done!

SpringPure7

Here is the example core.

Good luck!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s