Skip to content

Struts Spring Hibernate Integration

November 5, 2012

Struts with Spring:
Spring with Struts scenario: (Integrating Spring with other web frameworks – Struts)
We can acquire a particular web framework such as Struts, while at the same time being able to enjoy the benefits afforded by Spring in other areas such as data access, declarative transaction management, and flexible configuration.
To INTEGRATE your Struts 1.x application with Spring, you have two options:
Configure Spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependencies in a Spring context file.
Subclass Spring’s ActionSupport classes and grab your Spring-managed beans explicitly using a getWebApplicationContext() method.
 Reference: 0)

Spring with Hibernate:

Spring configuration file will have:

Pom.xml Dependencies:

Need to mention Spring Dependencies and Hibernate Dependencies as below:

        <!– Spring framework –>
        <!– Spring AOP dependency –>

<!– Hibernate annotation –>

Spring Config file should have the below code:

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManagerName" value="java:/TransactionManager"/>

or if you are using Websphere, then

<bean id=”transactionManager”  class=”org.springframework.transaction.jta.WebSphereUowTransactionManager” />


From → Uncategorized

Leave a Comment

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: