{"id":65975,"date":"2021-07-18T10:54:07","date_gmt":"2021-07-18T14:54:07","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/introduction-to-spring-java-short-notes\/"},"modified":"2022-05-10T20:12:12","modified_gmt":"2022-05-11T00:12:12","slug":"introduction-to-spring-java-short-notes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65975","title":{"rendered":"Introduction to Spring #Java Short Notes"},"content":{"rendered":"<ul>\n<li>Open-sourced on February, 2003<\/li>\n<li>Layered J2EE application framework<\/li>\n<li>Inversion of Control (IoC): A Data Access Object (DAO) depends on a DataSource.<\/li>\n<li>Allows: code to interfaces<\/li>\n<li>Spring has classes to support Hibernate, Struts, and other frameworks<\/li>\n<li>According to many Java developers [ref:internet], J2EE patterns are sometimes cumbersome. Spring uses patterns but made everything simpler<\/li>\n<li>ServiceLocator -&gt; to lookup Hibernate sessions. Spring Alternative: configure a SessionFactory<\/li>\n<li>Spring provides\/supports good programming practices such as, coding to interfaces, reducing coupling, easy testability.<\/li>\n<li>But EJBs require to run EJB containers (WebLogic, JBoss, Websphere) to test them [testability problems inherent in EJBs] [as of 2005]<\/li>\n<li>Over the time EJB [EJB 3.0 ] has recovered some of the issues like testability, portability [ 1. EJB 2.0 has deployment descriptors but EJB 3.0 has no deployment descriptor, 2. In EJB 2.0 you have to write Home and Remote Interfaces But in EJB3.0 you do not need to write Home interfaces, 3. In EJB 3.0, all entities are identified with &#8216;@&#8217;, 4. In EJB 3.0 methods like ejbPassivate, ejbActivate, ejbLoad, ejbStore, etc. are not required, 5. EJB 3.0 is totally newly designed including the entity manager, 6. EJB 3.0 entity beans are just POJO, 7. No EJB container required to run, 8. EJB 3.0 supports Java Persistence API for all of its data needs, 9. No XMLDeployment Descriptors but annotations, 10. EJB 3.0 entity beans\/JPA becomes local, 11. Queries are very flexible. Multiple levels of joins are enabled, 12. EJB 3.0 pluggable, security enabled ]<\/li>\n<li>Spring Criticisms [as of 2005]: It&#8217;s not an standard like EJBs, too heavyweight (though custom selection of modules\/jars will help)<\/li>\n<li>How Spring works: Spring can configure applications using JavaBeans. A class can expose it&#8217;s dependency through setters, Spring can configure that dependency.<\/li>\n<li>Inversion of Control\/Dependency Injection: Wiring dependent objects together through a container<\/li>\n<li>Spring Modules: Spring AOP (source level metadata), ORM (Hibernate, iBATIS, JDO support), Spring Web (WebApplicationContext, MultipartResolver, Web Utilities), DAO (Transaction Infrastructure, JDBC, DAO support), Context (ApplicationContext, UI Support, Validation, JNDI, EJB, Remoting support, Mail), MVC (Web Framework, Web Views, JSP, Velocity, Freemarker, PDF, Excel, XML\/XSL)<\/li>\n<li>Spring advantage over J2EE: Reducing Coupling: It&#8217;s better not to tightly couple any application to a specific resource. In J2EE, for database operations typically an abstract Factory class (DAOFactory) is defined and a class is written for each specific implementation (DAOFactoryOracle). [J2EE Factory Pattern]. It creates additional issues such as managing dependencies of these factoried objects, handling Hibernate Session<\/li>\n<li>Spring approach: bind interfaces to implementations, configure everything in an XML file, and modify the XML file as required for switching, unit tests can be written without the knowledge of the implementation [great with Hibernate and iBATIS] p30. Define the bean in the applicationContext.xml file, and use it from your code through ClassPathXmlApplicationContext, get a reference to the bean using ClassPathXmlApplicationContext.getBean. You can change the class property in the bean definition to use a different implementation<\/li>\n<li>You can use Hibernate from Spring (ORM support). If you go through wrapping classes of Spring to provide Hibernate functionalities, you will not require to worry about (try, catch) checked exceptions that Hibernate usually throws<\/li>\n<\/ul>\n<p> From: http:\/\/sitestree.com\/?p=4923<br \/> Categories:Java Short Notes<br \/>Tags:<br \/> Post Data:2006-10-26 16:03:22<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Open-sourced on February, 2003 Layered J2EE application framework Inversion of Control (IoC): A Data Access Object (DAO) depends on a DataSource. Allows: code to interfaces Spring has classes to support Hibernate, Struts, and other frameworks According to many Java developers [ref:internet], J2EE patterns are sometimes cumbersome. Spring uses patterns but made everything simpler ServiceLocator -&gt; &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65975\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917,1956],"tags":[],"class_list":["post-65975","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","category-java-spring","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":66421,"url":"http:\/\/bangla.sitestree.com\/?p=66421","url_meta":{"origin":65975,"position":0},"title":"Key J2EE  Components : Basic Concepts with Examples #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 19, 2021","format":false,"excerpt":"Java EE 5 (J2EE 5) uses XML deployment descriptors for the configuration of the web-applications and web-components. What Java EE provides? It provides the internal framework\/structure\/system level capability\/system-level infrastructure to support large enterprise level applications with features like distributed database, distributed computing , security, and transaction management. J2EE also provides\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":67364,"url":"http:\/\/bangla.sitestree.com\/?p=67364","url_meta":{"origin":65975,"position":1},"title":"What is Hibernate? #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 20, 2021","format":false,"excerpt":"Why Hibernate? A database is an integral part of many different types of applications. Standalone single-person applications to multi-user distributed business and enterprise applications make extensive use of databases. Many high end technology applications in industries including telecommunications, and surveillance systems make extensive use of databases. However, in recent years,\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":67446,"url":"http:\/\/bangla.sitestree.com\/?p=67446","url_meta":{"origin":65975,"position":2},"title":"Topics to Learn in Java Spring framework #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 22, 2021","format":false,"excerpt":"Why Spring Framework?What's wrong with Java EE (EJB)Light-weight vs. heavy-weight containersMotivation for SpringSpring BackgroundSpring Framework OverviewSpring featuresSpring light-weight container architectureSpring application contextInversion of Control (IoC) design patternDependency Injection (DI)Advantages of IoC\/DIDesign for testabilityLow couplingCode re-useConsistent architecture and configurationEasy-to-follow designGood OOPSpring Installation and ConfigurationSpring libraries and dependanciesXML configuration filesAnnotationsSpring IDEOverviewFeaturesInstallationEditors, Wizards,\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":66338,"url":"http:\/\/bangla.sitestree.com\/?p=66338","url_meta":{"origin":65975,"position":3},"title":"J2EE Architecture: J2EE Design Patterns: Related Concepts #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 18, 2021","format":false,"excerpt":"Design Patterns What are design patterns? Design patterns are specific\/(context-based) solutions\/approaches to address specific problems\/situations. Some problems are general\/open problems and very common problems in a particular type of applications. Design patterns can be created to solve such problems in a specific context and that can be re-used every time\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65920,"url":"http:\/\/bangla.sitestree.com\/?p=65920","url_meta":{"origin":65975,"position":4},"title":"What is Spring Framework? What does it mean to J2EE developers #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 17, 2021","format":false,"excerpt":"What is Spring Framework? What does it mean to J2EE developers? Spring is a light-weight framework, very often referred as an alternative\/competitor to EJB, for the development of enterprise-type applications. Spring provides many features such as declarative transaction management, access to remote logic using RMI or web services, mailing facilities\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":66328,"url":"http:\/\/bangla.sitestree.com\/?p=66328","url_meta":{"origin":65975,"position":5},"title":"Accessing EJBS from Servlet #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 18, 2021","format":false,"excerpt":"EJBs can be used to create enterprise applications like banking systems. Clients will interact with such systems for operations like: withdraw cash, transfer cash, pay bills When clients directly access EJBs it poses concerns such as: security risks, firewall blocking, EJB architecture becomes transparent to the clients Servlets can act\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65975"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65975\/revisions"}],"predecessor-version":[{"id":74591,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65975\/revisions\/74591"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65975"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}