Monday, January 2, 2012

Creating Spring Bean To Facilitate Java Application Development

The J2ee is aspect oriented programming and the spring is object oriented programming. Combining both will be very useful in Java application development programming. Here let’s read more about the interceptor mechanism that is used as part of J2EE development.

First of all a spring bean an object oriented has to be made by the Java application development framework. After which the java bean will be made for the spring bean.  After this an interface has to be created for the bean class. To enable this feature, J2EE development team ahs to go to the project mode and select new wizard. There select java interface and click on next. Decide on the package name and click finish. The interface is shown below

package spring.catalog;

public interface CatalogInterface {

                public void setJournal(String journal);

                public String getJournal();

                public void setPublisher(String publisher);

                public String getPublisher();

                public void setEdition(String edition);

                public String getEdition();

                public void setTitle(String title);

                public String getTitle();

                public void setAuthor(String author);

                public String getAuthor();

To implement the interface the catalog.java has to be added and that is done in the following manner.

package spring.catalog;
public class Catalog implements CatalogInterface {
      public String journal;

      public String publisher;

      public String edition;

      public String title;

      public String author;
 
public Catalog(){}

      public Catalog(String journal, String publisher, String edition,

     String title, String author) {
            this.journal = journal;

            this.publisher = publisher;

            this.edition = edition;

            this.title = title;

            this.author = author;

      }
      public String getAuthor() {

            // TODO Auto-generated method stub

            return author;

      }
      public String getEdition() {

            // TODO Auto-generated method stub

            return edition;

      }
      public String getJournal() {

            // TODO Auto-generated method stub

            return journal;

      }
      public String getPublisher() {

            // TODO Auto-generated method stub

            return publisher;

      }
      public String getTitle() {

            // TODO Auto-generated method stub

            return title;

      }
      public void setAuthor(String author) {

            // TODO Auto-generated method stub

            this.author = author;

      }
      public void setEdition(String edition) {

            // TODO Auto-generated method stub

            this.edition = edition;

      }
      public void setJournal(String journal) {

            // TODO Auto-generated method stub

            this.journal = journal;

      }
      public void setPublisher(String publisher) {

            // TODO Auto-generated method stub

            this.publisher = publisher;

      }
      public void setTitle(String title) {

            // TODO Auto-generated method stub

            this.title = title;

      }
      public String getTestMessage() {

            return "Spring Bean Test";

      }

Looking for a Developer with strong Data Analysis and BI skills? For Microsoft Business Intelligence Software Development, Contact Us for BI Software Development.