TechnoBuzz

A Techno Blog, mainly about Java

Jayson JSON

Marshalling : takes your custom objects and converts them to XML, JSON or other serialization formats.

Unmarshalling : creation of custom objects from XML

Gunner Hillert  :  “The easiest way to marshal JSON in Spring MVC is via the Jackson Java JSON-processor

Create JSON response from Spring MVC 3 :  “Spring MVC invokes a MappingJacksonHttpMessageConverter built on the Jackson JSON processor. This implementation is enabled automatically when you use the mvc:annotation-driven configuration element with Jackson present in your classpath”

The @ResponseBody annotation is similar to @RequestBody  : ” This annotation can be put on a method and indicates that the return type should be written straight to the HTTP response body (and not placed in a Model, or interpreted as a view name).”

Spring MVC wth @ResponseBody : “Spring will automatically marshall the return value of an annotated method to XML, JSON, etc. ”

From SpringSource : “Underneath the covers, Spring MVC delegates to a HttpMessageConverter to perform the serialization. In this case, Spring MVC invokes a MappingJacksonHttpMessageConverter built on the Jackson JSON processor. This implementation is enabled automatically when you use the mvc:annotation-driven configuration element with Jackson present in your classpath.”

http://jackson.codehaus.org/

http://wiki.fasterxml.com/JacksonInFiveMinutes

http://wiki.fasterxml.com/ObjectMapper

Jackson 2.0

http://www.mkyong.com/spring-mvc/spring-3-mvc-and-json-example/

Advertisements

March 6, 2013 Posted by | IoC, Spring | Leave a comment

Spring Documento

In web.xml with Spring MVC (Convenient ApplicationContext instantiation for web applications):

ContextLoader called  by ContextLoaderListener

[ref] : “ContextLoaderListener creates a root web-application-context for the web-application and puts it in the ServletContext. This context can be used to load and unload the spring-managed beans ir-respective of what technology is being used in the controller layer(Struts or Spring MVC) ”

  • org.springframework.web.servlet.DispatcherServlet

[ref] : “DispatcherServlet creates its own WebApplicationContext and the handlers/controllers/view-resolvers are managed by this contextContextLoader”

“When ContextLoaderListener is used in tandem with DispatcherServlet, a root web-application-context is created first as said earlier and a child-context is also created by DispatcherSerlvet and is attached to the root application-context.”

http://static.springsource.org/spring/docs/3.0.x/reference/index.html

org.springframework.web.filter.DelegatingFilterProxy

[ref] Spring’s DelegatingFilterProxy provides the link between web.xml and the application context. .. “it finds a bean (“target bean” or “delegate”) in your Spring application context, an invoke it. How is it possible? Because this bean implements javax.servlet.Filter, its doFilter method is called.”

  • org.springframework.context.support.ReloadableResourceBundleMessageSource

[link ] :  The feature I’m talking about is the ability to reload (and detect changes in) i18n property files on-the-fly.

org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter

This interface that maps handlers based on HTTP paths expressed through the RequestMapping annotation at the type or method level.

 

October 14, 2012 Posted by | IoC | Leave a comment

Spring MVC Refresher II

web.xml

browsers currently only support GET and POST, a common technique – is to use a normal POST with an additional hidden form field  (_method) to pass the “real” HTTP method.

< filter >
< filter-name >httpMethodFilter </  filter-name >
< filter-class >org.springframework.web.filter.HiddenHttpMethodFilter < /  filter-class >
< / filter >

accounts-servlet-config.xml:

< context:component-scan base-package=”accounts.web” />

< mvc:annotation-driven/ >

An interceptor which keeps a hibernate session open to allow lazy loading of backing object
< mvc:interceptors >
< bean class=”org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor” >
< property name=”sessionFactory” ref=”sessionFactory”/ >
< /bean >
< /mvc:interceptors >
< bean class=”org.springframework.web.servlet.view.InternalResourceViewResolver” >
< property name=”prefix” value=”/WEB-INF/views/”/ >
< property name=”suffix” value=”.jsp”/ >
< /bean >

When you use a ContentNegotiatingViewResolver your web controllers return ModelAndViews or view names and the ContentNegotiatingViewResolver will, based on various criteria, choose the right data representation strategy, Here for JSON Use Jackson Java JSON-processor

< bean class=”org.springframework.web.servlet.view.ContentNegotiatingViewResolver” >
< property name=”mediaTypes” >
< map >
< entry key=”json” value=”application/json”/ >
< /map >
< /property >
< property name=”defaultViews” >
< bean class=”org.springframework.web.servlet.view.json.MappingJacksonJsonView”/ >
< /property >
< /bean >

Note: if had not have used component scanning would have had to wire up the controller

A Spring MVC @Controller

imports:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

package accounts.web;

@Controller
public class AccountController {

private AccountManager accountManager;

@ Autowired
public AccountController(AccountManager accountManager) {
this.accountManager = accountManager;
}

The method does not explicitly select a view name because the default
view name selected by Spring MVC matches to the incoming URL accountDetails.jsp
@ param id the id of the account
@ param model the “implicit” model created by Spring MVC

@ RequestMapping(value=”/accounts/{accountId}”,  method=RequestMethod.GET)
public void accountDetails(@PathVariable(“accountId”) int id, Model model) {
model.addAttribute(“account”, accountManager.getAccount(id)); return “accountDetails”;
}

The method does not explicitly select a view name because the default
view name selected by Spring MVC matches to the incoming URL accountSummary.jsp

@ param model the “implicit” model created by Spring MVC

@ RequestMapping(value=”/accounts”, method=RequestMethod.GET)
public void accountSummary(Model model) {
model.addAttribute(“accounts”, accountManager.getAllAccounts());return “accountSummary”;
}

index.html:

< a href=”app/accounts” >View Account Summary< /a >

http://localhost:8080/ss/app/accounts

Then on the listing page you click on one of the entries to get details

http://localhost:8080/ss/app/accounts/6

This uses the Path Variable

@ RequestMapping(value=”/accounts/{accountId}”,  method=RequestMethod.GET)
public void accountDetails(@PathVariable(“accountId”) int id, Model model) {

September 16, 2012 Posted by | IoC | Leave a comment

Spring MVC refresher

web.xml:

application context Beans makeup the configuration of the root web application context
< context-param >
< param-name >contextConfigLocation< /param-name >
< param-value >/WEB-INF/accounts-application-config.xml< /param-value >
< /context-param >

Bootstraps the root web application context before servlet initialization
< listener >
< listener-class >org.springframework.web.context.ContextLoaderListener< /listener-class >
< /listener >

Deploys the dispatcher servlet along with its configuration
< servlet >
< servlet-name >accounts< /servlet-name >
< servlet-class >org.springframework.web.servlet.DispatcherServlet< /servlet-class >
< init-param >
< param-name >contextConfigLocation< /param-name >
< param-value >/WEB-INF/accounts-servlet-config.xml< /param-value >
< /init-param >
< /servlet >
accounts-servlet-config.xml:

< context:component-scan base-package=”accounts.web” />

< mvc:annotation-driven/ >

An interceptor which keeps a hibernate session open to allow lazy loading of backing object
< mvc:interceptors >
< bean class=”org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor” >
< property name=”sessionFactory” ref=”sessionFactory”/ >
< /bean >
< /mvc:interceptors >
< bean class=”org.springframework.web.servlet.view.InternalResourceViewResolver” >
< property name=”prefix” value=”/WEB-INF/views/”/ >
< property name=”suffix” value=”.jsp”/ >
< /bean >

Note: if had not have used component scanning would have had to wire up the controller

A Spring MVC @Controller

imports:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

package accounts.web;

@Controller
public class AccountController {

private AccountManager accountManager;

@ Autowired
public AccountController(AccountManager accountManager) {
this.accountManager = accountManager;
}

The method does not explicitly select a view name because the default
view name selected by Spring MVC matches to the incoming URL accountDetails.jsp
@ param id the id of the account
@ param model the “implicit” model created by Spring MVC

@ RequestMapping(“/accountDetails”)
public void accountDetails(@RequestParam(“entityId”) int id, Model model) {
model.addAttribute(“account”, accountManager.getAccount(id));
}

The method does not explicitly select a view name because the default
view name selected by Spring MVC matches to the incoming URL accountSummary.jsp

@ param model the “implicit” model created by Spring MVC

@ RequestMapping(“/accountSummary”)
public void accountSummary(Model model) {
model.addAttribute(“accounts”, accountManager.getAllAccounts());
}
}

index.html:

< a href=”accounts/accountSummary” >View Account Summary< /a >

http://localhost:8080/ss/accounts/accountSummary

Click on one of the listing entries

http://localhost:8080/ss/accounts/accountDetails?entityId=7

Again, this uses RequestParamin the nethod signature

public void accountDetails(@RequestParam(“entityId”) int id, Model model)

September 15, 2012 Posted by | IoC, Web Design | Leave a comment

Core Spring via Interface21~SpringSource~VMWare

I am taking the Core Spring Class by VMWARE with Chris Lacy (http://www.chrislacy.net/).

I will note some of the key information I see over the four days.

Building software:

Running software

Dependency Injection

Previous entries on Spring:  DIP Exceptions , Testing , Spring 2.0 , IBatis Spring , Web Flow

June 29, 2010 Posted by | IoC, Spring | Leave a comment

Testing through Spring with rollbacks

If you download the spring framework with dependencies, one of the modules included is the spring-test.

spring
– Convenient jar file combining all standard modules (except for the test module and the Spring MVC support)
– Also includes the AOP Alliance interfaces (as a convenience)!
– Does not include contents of spring-aspects.jar, spring-test.jar and spring-webmvc*.jar!

spring-test
– Contents: test context framework, JUnit support, JNDI mocks, Servlet API mocks, Portlet API mocks
– Dependencies: spring-core, (spring-context, spring-jdbc, spring-web, JUnit, Servlet API, Portlet API)

As the spring documentation mentions, for unit testing transactional systems you can achieve rollback of your tests pretty easily:

Typically you will extend the subclass, AbstractTransactionalDataSourceSpringContextTests. This class also requires that a DataSource bean definition – again, with any name – be present in the application context. It creates a JdbcTemplate instance variable, that is useful for convenient querying, and provides handy methods to delete the contents of selected tables (remember that the transaction will roll back by default, so this is safe to do).

This problem was identified with MySql.

Nice article here on spring test

This link tells us about the spring testing method calls

AbstractTransactionalDataSourceSpringContextTests superclass
provides the following services:

Injects test dependencies, meaning that we don't need to
perform application context lookups. Injection uses
autowiring by type.

Executes each test method in its own transaction, which is
automatically rolled back by default. This means that even 
if tests insert or otherwise change database state, there
is no need for a teardown or cleanup script.

If you want a transaction to commit--unusual, but useful 
if you want a particular test to populate the database,
for example--you can call the setComplete() method inherited
from AbstractTransactionalSpringContextTests. This will cause
the transaction to commit instead of roll back.

There is also convenient ability to end a transaction before
the test case ends, through calling the endTransaction() method.
This will roll back the transaction by default, and commit it
only if setComplete() had previously been called.

Provides useful inherited protected fields, such as a JdbcTemplate
that can be used to verify database state after test operations,
or verify the results of queries performed by application code.
An ApplicationContext is also inherited, and can be used for
explicit lookup if necessary.

All the Spring Test Life Cycle Methods

API

  • getConfigLocations
  • setDataSource
  • setTransactionManager
  • onSetUpBeforeTransaction
  • onSetUpInTransaction
  • onTearDownInTransaction
  • endTransaction
  • onTearDownAfterTransaction

example scenario:

Now onto the 2.5 way of testing:

org.springframework.test.context – Spring TestContext Framework which provides annotation-driven unit and integration testing support that is agnostic of the actual testing framework in use.

Spring 2.5 continues this rich and convenient testing framework, while now removing the requirement that your unit tests extend Spring framework tests. Instead of subclassing, it uses java annotations.

Related links:

August 24, 2008 Posted by | IoC, J2EE | 1 Comment

Seam

I couple months ago I heard the podcast with Gavin King about Seam. I came across this blog posting talking about Seam. I do see alot more people using EJBs than what was done in the past now that with JPA and IoC all in one. I do not see Spring going away though.

May 28, 2006 Posted by | Hibernate & ORM, IoC, Spring | Leave a comment

spring & hibernate

spring 2.x: Alex – Main – discussing with Rod and Rob

Tutorial with Hibernate: Hibernate

Hibernate + Spring : this looked like a decent example,  follow on as I do not know German and translated to English below.

Continue reading

December 23, 2005 Posted by | IoC | Leave a comment

a wiki

Link: Dashboard – Confluence.

September 25, 2005 Posted by | IoC | Leave a comment

Spring again

Link: Logemann Blog.

September 22, 2005 Posted by | IoC | Leave a comment

CodeHaus

Open Source project that uses Spring.

September 19, 2005 Posted by | IoC | Leave a comment

Article: The Spring Loaded Observer Pattern

Link: Article: The Spring Loaded Observer Pattern.

September 16, 2005 Posted by | IoC | Leave a comment

The Spring series, Part 3: Swing into Spring MVC

Link: The Spring series, Part 3: Swing into Spring MVC.

September 6, 2005 Posted by | IoC | Leave a comment

Integration of Spring/Struts

I have been doing the IoC thing lately within Struts. Basically, for each action I’d like to inject a suite of service methods/biz procs. I am familar with Rod Johnson school of thought, but am relatively new to using Spring. The first method to get up and running pretty quickly involved inheriting form Spring’s ActionSuppot class instead of Struts Action. You get access to the Action Support class by adding the plugin to your Struts config file:

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml"/>
</plug-in>

I have a bean defined in applicationContext as follows:

<bean id="firstBizProcess" class="test.BizProcess1"/>

<bean id="bean1" class="test.NewThingMapping">
<property name="bizProcess">
<ref bean="firstBizProcess" />
</property>
</bean>

Then in your ActionSupport class instance all you have to do is the following:

ApplicationContext myContext = getWebApplicationContext();

Supplemental q = (Supplemental)myContext.getBean("Bean1");

Now you are wired to the service method via a call like
q.getBizProcess().doServiceMethod1();

Getting set up here was quick and easy but, you are obviously heavily tied to Spring in your MVC Struts.

A second method is to have your Struts config type point to Spring’s org.springframework.web.struts.DelegatingActionProxy.

Then, create an association between your specific path action to your Action class and the bean you want to inject into the Action within your applicationContext xml file.

Here is an example : < bean name="/mypathforaction" class="test.MyAction">

Then in your Action class, you can inherit from the regular Struts Action class.

Only thing is that you need a getter/setter for the bean you are injecting.
public BizProccess getBizProcess() { return bizProcess; }
public void setBizProcess(BizProccess bizProcess) { this.bizProcess = bizProcess; }

A last method is one I read about in the Pro Spring book.

In web.xml , you indicate your context config file as follows

<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param>

Then in your action, you inherit from regular Struts Action but you need to create a setter methos for your context:

public void setServlet (ActionServlet as) {

ServletContext sc = as.getServletContext();

WebApplicationContext wac = WebApplicationContextUtils.getRequiredApplicationContext(sc);

}

This way of intergrating struts with spring is similar to article here.

[best practices?]

September 2, 2005 Posted by | IoC | Leave a comment

Spring TopLink

Link: Step 9: Mastering Server-Side Java (Part 2).

September 1, 2005 Posted by | IoC | Leave a comment

Frameworks and such

A co-worker pointed me to this article by Rod Johnson on J2EE frameworks and the application programming model. The article is dated as January 2005.

The application code calls a class to perform a service (i.e LOG4J) ,  whereas a framework calls application code and manages the flow of control.

Thus, frameworks are are a set of classes that make up a resusable design that are used by extending them rather than instantiating them. One important point on that is mentioned is that successful open source frameworks are better tested than creating an in house one. People are more open to adpot an open source framework if it delivers clear benefits, whereas in house frameworks are often mandated.

Struts – an open source MVC framework (pull data from model, pushes data to view). Its a layer on top of the Servlet/JSP model.

Hibernate – first popular O/R Mapping open source solution. It was poular due to ease of use.

Spring – integrating the application stack. Model in which application objects decopled from the J2EE environment (i.e reusable) and the framework instantiates the and configures them for use. Also, provides declaritive transaction managemnt of POJO.

Web Layer – accpets input from the user . Presents results it recives from the application layer for a given request. As well, displays an error messages or warnings. (Struts )

Application layer – accepts input from the web tier, invokes the
proper  application object. The application objects will invoke business object(s) to
accomplish the requested tasks. The results the application objects  recieve from the business objects are pushed presentation layer for display. (Spring)

 

Business  Layer – Made up of business objects which perform
specific tasks or services. They invoke data access objects to communicate
with the database.

Data Access  Layer –  This consists of data access objects that communicate
directly with the database. Data access
objects (DAOs) contain methods that each execute specific queries against the
database. DAOs extract the results of queries into object collections that are
returned to the business objects. (Hibernate)

 

 

Continue reading

August 20, 2005 Posted by | IoC | Leave a comment

Hibernate/Jboss are anti-Spring

Link: mockhaug � Hibernate hates Spring:”Until Spring redesigns their Hibernate integration stuff, we simply cannot recommend it to our users. Some people think we should still recommend Spring to people, even though we think the Hibernate integration is flawed.”

August 13, 2005 Posted by | IoC | 1 Comment

Dyna Forms

Denver Java Users Group has a talk on Dynamic Struts Forms.

I noticed they have a nice ppt presentation on Spring/Hibernate.

August 8, 2005 Posted by | Hibernate & ORM, IoC, Struts | Leave a comment

DW Spring Intro

Link: Intro on DeveloperWorks

Download the Spring Framework 1.2 RC2 Zip file here and extracted it to my c drive (C:\spring-framework-1.2-rc2).

Get the code associated with the article wa-spring1-SpringProject.zip here.
and extracted it to my c:/eclipse/workspace/SpringProject.  Note that I did this in eclipse 3.1

copy spring.jar and spring-context from C:\spring-framework-1.2-rc2\dist to   SpringProject\lib folder.

Get Jakarta Commons Logging  from here and copy  commons-logging.jar to the SpringProject\lib folder.

Find ANT build file within SpringProject
Run as … clean-build
Run as … main

 

July 31, 2005 Posted by | IoC | Leave a comment

Better EE w Spring

link : "a whirlwind tour of IoC in general and Spring in particular"

July 17, 2005 Posted by | IoC | Leave a comment

jboss and interface21

This link is pretty entertaining.  EJB3, Spring. Choices.

July 14, 2005 Posted by | IoC | Leave a comment

The Pro Spring Book

link: "The sample application developed in the book is a “Spring Blog”; all the code is clear and well explained, and there are several other example all throughout the book (obviously you can find them online: chapter source code and sample application). Overall, “Pro Spring” is a must-have if you plan to use Spring in your project."

July 12, 2005 Posted by | IoC | Leave a comment

SourceBeat Chapter

Based on post a few months back on a positive experience with the Spring Live chapter 2 [tss] , thought I’d finally try it out. [forum] [wiki FAQ]
JAVA_HOME is C:\j2sdk1.4.2_05\
ANT_HOME is C:\apache\apache-ant-1.6.2
CATALINA_HOME is C:\apache\jakarta-tomcat-5.0.27
PATH has C:\apache\apache-ant-1.6.2\bin;C:\j2sdk1.4.2_05\bin; C:\apache\jakarta-tomcat-5.0.27\bin

https://equinox.dev.java.net/files/documents/1901/5728/equinox-1.0.zip extract to C:\sourcebeat\

C:\sourcebeat\equinox>ant new -Dapp.name=myusers

copy  C:\sourcebeat\myusers to CATALINA_HOME\webapps

CATALINA_HOME\conf\tomcat-users I added
  <user username="admin" password="admin" roles="manager"/>

C:\apache\jakarta-tomcat-5.0.27\webapps\myusers>ant list

C:\apache\jakarta-tomcat-5.0.27\webapps\myusers>ant deploy

went into manager http://localhost:8080/manager and add myusers directory

http://localhost:8080/myusers/&nbsp; , get page with:
"Equinox is a lightweight version of AppFuse. I was inspired to create it when looking at the struts-blank and webapp-minimal applications that ship with Struts and Spring, respectively. These "starter" apps were not robust enough for me, and I wanted something like AppFuse, only simpler. "

Code up UserDAO ,  User, User.hbm.xml   [Spring live source code]

Here, I found I must change the url  in the WEB-INF/applicationContext.xml which I changed to
<property name="url"><value>jdbc:hsqldb:C:/apache/jakarta-tomcat-5.0.27/webapps/myusers/db/appfuse</value></property>

Also, in this file set the MappingResources property value to indicate the location of
org/appfuse/model/User.hbm.xml

C:\apache\jakarta-tomcat-5.0.27\webapps\myusers>ant deploy reload

C:\apache\jakarta-tomcat-5.0.27\webapps\myusers>ant browse

The place where you configure a Java EE app to use Spring is in the web.xml file. What you do is
set the listener :
<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

The next step is configuring spring with hibernate. We will look in the applicationContext.xml
The session factory bean that has a dependency on data source bean:

<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
        <property name="dataSource"><ref local="dataSource"/></property>
        <property name="mappingResources">
            <list>
                <value>org/appfuse/model/User.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">net.sf.hibernate.dialect.HSQLDialect</prop>
            <prop key="hibernate.hbm2ddl.auto">create</prop>
        </props>
        </property>
    </bean>

The data source bean:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName"><value>org.hsqldb.jdbcDriver</value></property>
        <property name="url"><value>jdbc:hsqldb:C:/apache/jakarta-tomcat-5.0.27/webapps/myusers/db/appfuse</value></property>
        <property name="username"><value>sa</value></property>
        <property name="password"><value></value></property>
    </bean>

The transaction manager bean which depends on the session factory:

<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
        <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>

Now we code up UserDAOHibernate  [Spring live source code]

In applicationContext.xml we create a  relationship to the UserDAOHibernate :

<bean id="userDAO" class="org.appfuse.dao.hibernate.UserDAOHibernate"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean>

[myusers w/eclipse]

Some Spring links:

 

July 12, 2005 Posted by | IoC | Leave a comment

XML improvments with Spring

Spring &XML : "XML is a perfect way to express the static assembly of your application; the configuration that is needed to get things going. Actual behavior related to the problem your application is solving shouldn’t be coded in XML. That’s what the application code is for"

He goes on to indicate the enhancements to Spring’s XML

July 10, 2005 Posted by | IoC | Leave a comment

Some examples

Road to hibernate

http://jroller.com/page/prokhorenko/20050629

lead me to here.

June 30, 2005 Posted by | Hibernate & ORM, IoC | Leave a comment

DAOs

DAOs (Data Access Objects) make use of the Template Method whereby there are several steps required, but you are only concern yourself with some of the steps. You encapsulate the individual steps we dont know how to perform as abstract methods, and provide an abstract superclass that invokes them .

I will have a Concrete subclasses of this abstract superclass implement the abstract methods to perform the individual steps.

For example, I have this method FindAllResources which returns a List which does a SQL Select operation.  All I have to be concerned with here is creating the select string and parameters and send it off to the SQL JDBC task.

List filterParms =

String statement ="SELECT …."

return this.findZeroOrMoreRecords(statement, filterParms.toArray());

I also have to copy what comes back from the database into a bean with the method:

Object processResultSetRow(ResultSetRow row)

June 20, 2005 Posted by | IoC | Leave a comment

Ref Doc on Spring

The project I am working on now makes use of an assembler (i.e. autowiring) and gathers the required classes indicated  through an XML files. It works as follows:

In the struts config file, for each action their additional information (properties) that indicates the action helper and the index into the business process  configuration  file. The bp configuration file entry indicates the transaction isolation , the business  process method that gets invoked for this action, the input bean object for the biz process, and the resulting  output bean object that the biz process returns. Thus, for the action you are telling it what the business process is, rather than having it to ask what the business process is. Thus, basically it is performing the role of autowiring the biz objects  or known as Inversion of control.  This architecture was based on Rod Johnson’s interface21 I am told. It was done before there was a thing called Spring.

The Spring documentation  .

The Mailing list  for Spring can be found at   springframework-developer

In this presentation, shows how to use spring:

– go to spring download page http://www.springframework.org/download
– click on the  Sourceforge link
– get the dependicies zip file ( i.e  spring-framework-1.2.2-with-dependencies.zip) and unzip it

Spring Hello world

Google  helped me find this nice [presentation] and this [course]

Bean factories: creates, configures and manages Java objects. The configuration details are typically kept in xml or property files .
org.springframework.beans.factory.Beanfactory
Application contexts: extends BeanFactor, and therefore provides all the same functionality, but also provides extra enterprise level fxns.
org.springframework.contexts.ApplicationContext

June 19, 2005 Posted by | IoC | Leave a comment

interface21

From The Server Side comes a talk / thread by Rod Johnson from the 2005 Java Symposium.

Other Tech Talks by Rod Johnson on TheServerSide.com
Rod Johnson on J2EE Design, AOP, The Spring Framework
Rod Johnson on The Spring Framework, AOP

Craig R. McClanahan  on TheServerSide.com
JavaServer Faces: Dead on Arrival or Raging Success?
Craig McClanahan on Java Server Faces
Craig McClanahan on The STRUTS Framework

Cameron Purdy  on TheServerSide.com
Architecting for Scalable Performances using Clustered Caching
Cameron Purdy on Caching

June 16, 2005 Posted by | IoC | Leave a comment

Spring Book

I read this review on Spring in Action. The book is now purchased and on the way. 

Rod Johnson’s sample code from his J2EE Design and Development book I am told is what evolved into the Spring project.

June 9, 2005 Posted by | IoC | Leave a comment

spring

Link: The kdonald blog.

February 3, 2005 Posted by | IoC | Leave a comment

IoC and Dependency Injector Pattern

[intro]

DIP
[another]

December 19, 2004 Posted by | IoC | Leave a comment

Hollywood Principle

The object that needs to be implemented does not need to instantiate the dependent objects and can rely on the assembler to do the job

The assembler will gather and instantiate, if necessary, all the dependent objects and make them available to the implemented object.

The assembler gathers the required classes through configuration files so a change in the assembler only needs changes to the configuration file.

An example of an assembler is the Spring Framework.

Template Method design patterns (GoF) – Centralization of workflow logic into an abstract superclass. Framework code in the superclass invoke user code.

Problem: Know the steps of an algorithim and the order of the steps, but dont know how to perform all the steps.

Solution: Encapsulate the individual steps we dont know how to perform as abstract methods, and provide an abstarct superclass that invokes them in the correct order. Concrete subclasses of this abstract superclass implement the abstarct methods to perform the individual steps.

[IoC Struts]

December 18, 2004 Posted by | IoC | Leave a comment

Spring experience

link: – The sample chapter from Spring Live is mentioned as well as the Hibernate developer journal book.

December 2, 2004 Posted by | IoC | Leave a comment

AOP

Introduction to AOP

November 12, 2004 Posted by | IoC | Leave a comment

Spring Framework

Spring Framework  [forums]

Jetspeed to use Spring.  JPOX uses Spring as well.  [article
[article]

November 10, 2004 Posted by | IoC | Leave a comment

Inversion of Control

In a previous link blast, I leaned about IOC. Here is another article on the topic viaPyrasun 2.0 – The Spille Blog

November 8, 2004 Posted by | IoC | Leave a comment