Spring Configuration and Installation


@Configuration & @Bean Annotations

The @Configuration annotation specifies that a class can be utilized as a source of bean definitions by the Spring IoC container. Spring understands that a method annotated with @Bean returns an object that should be registered as a bean in the Spring application environment.

Spring Setup with JDK :-

    Step 1: setting up JDK

    The latest version of the SDK is available for download from Oracle's Java site. Finally, set the PATH and JAVA_HOME environment variables to the java and javac installation directories, usually java_install_dir/bin and java_install_dir, respectively.

    If you're using an Integrated Development Environment (IDE) such as Borland JBuilder, Eclipse, IntelliJ IDEA, or Sun ONE Studio, you'll need to compile and run an introductory program to ensure the IDE knows where you installed Java. Otherwise, you'll need to follow the instructions in the IDE's setup guide.

    Step 2: Download and install the Apache Common Logging API

    The Apache Commons Logging API is available for download at https://commons.apache.org/logging/. Unpack the binary package into a convenient location after downloading the installation. For example, on Windows, in C:commons-logging-1.1.1, or on Linux/Unix, in /usr/local/commons-logging-1.1.1. The following jar files, as well as additional supporting materials, will be found in this directory.

    Step 3:Install the Eclipse IDE

    Download the newest Eclipse binaries from https://www.eclipse.org/downloads/ to install Eclipse IDE. Unpack the binary package into a convenient location after downloading the installation. For example, on Windows, in C:\eclipse, or on Linux/Unix, in /usr/local/eclipse, and finally, update the PATH variable accordingly.

    Step 4 - Setup Spring Framework Libraries

    If everything seems promising, you can now set up your Spring framework. The basic procedures to download and install the framework on your PC are outlined here.

    1. Choose whether you want to install Spring on Windows or Unix, and then download the. The next step is the zip file for Windows or the .tz file for Unix.
    2. Spring framework binaries can be downloaded from https://jar-download.com/artifacts/org.springframework
    3. Spring-framework-4.1.6.RELEASE-dist.zip was downloaded on a Windows PC at the time of writing this guide. After unzipping the downloaded file, the directory structure inside E:\spring looks like this.

    The directory E:\spring\libscontains all of the Spring libraries. If you don't correctly set your CLASSPATH variable on this directory, you'll have problems launching your application. If you're using Eclipse, you won't need to set CLASSPATH because Eclipse will handle everything for you.