• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

New to Spring

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a question regarding the declaration of a bean ....

If I have a jar which is outside of my EAR and i want to get a handle or an instance of a bean from the outside jar ...
how can i have that ??? Is it the same as if I am working on a bean which is inside my EAR ....

I can add the outside jar and and then can configure the bean in my app-context.xml ?

I am little confused in this ...

Can anyone help ?
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yogesh Kumar Yadav wrote:
If I have a jar which is outside of my EAR and i want to get a handle or an instance of a bean from the outside jar ...
how can i have that ??? Is it the same as if I am working on a bean which is inside my EAR ....

I can add the outside jar and and then can configure the bean in my app-context.xml ?

I am little confused in this ...

Can anyone help ?



Consider using separate EAR file for that outside jar. And EJB client in EAR as remote client then your EJB in jar (in new EAR) should have remote home interface and parameters passed should be pass-by-value.
 
Ranch Hand
Posts: 85
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yogesh, Yes you can.

Simply add the jar file as an external library and create a bean like you will do for any other class. (If the class is present in classpath and you can instantiate it from code, then, you can do it from spring)
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Absolute yes! For example,now i am using the apache commons-dbcp.jar,i just add this jar to the library.And i can config
the class org.apache.commons.dbcp.BasicDataSource in spring xml file as thsi:
<!-- Commons DBCP -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="xxx.jdbc.Driver"/>
<property name="url" value="xxx"/>
<property name="username" value="xx"/>
<property name="password" value="xx"/>
<property name="initialSize" value="30"/>
<property name="maxActive" value="300"/>
<property name="testOnBorrow" value="true"/>
</bean>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic