aspose file tools*
The moose likes Spring and the fly likes Spring injection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring injection problem " Watch "Spring injection problem " New topic
Author

Spring injection problem

Mat Anthony
Ranch Hand

Joined: May 21, 2008
Posts: 237
Hi All,
currently trying to set up a listener with the different types of server jndi configurations.
Not sure how to setup oracleAppServer and weblogicAppServer so that I can use them within appServers.

<bean id="jndiInitialiseListener" class="org.my.apps.utils.JndiInitialiseListener">

<property name="appServers">
<map>
<entry key="oracleAppServer">
<ref local="oracleAppServer"/>
</entry>
<entry key="weblogicAppServer" >
<ref local="weblogicAppServer"/>
</entry>
</map>
</property>

</bean>

<bean id="oracleAppServer" class="java.lang.Object">
<map>
<entry key="java.naming.factory.initial" value="com.evermind.server.ApplicationClientInitialContextFactory" />
<entry key="java.naming.provider.url" value="ormi://localhost/" />
<entry key="java.naming.security.principal" value="xx11" />
<entry key="java.naming.security.credentials" value="xx22" />
</map>
</bean>
<bean id="weblogicAppServer" class="java.lang.Object">
<map>
<entry key="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory" />
<entry key="java.naming.provider.url" value="t3://localhost/" />
<entry key="java.naming.security.principal" value="xx33" />
<entry key="java.naming.security.credentials" value="xx44" />
</map>
</bean>

Mat
Mat Anthony
Ranch Hand

Joined: May 21, 2008
Posts: 237
Hi All,
is it possible to create a map of server names (i.e. oracleAppServer,weblogicAppServer etc).
Each of the names will ref a map containing the jndi configurations for that server.
Hence it would alow me to just pass a map of the server names to my JndiInitialiseListener class (i.e. via injection)

The example below means that I have to inject server names oracleAppServer and weblogicAppServer into my JndiInitialiseListener class;
hence it's not flexible.

<bean id="jndiInitialiseListener" class="org.my.apps.utils.JndiInitialiseListener">
<property name="oracleAppServer">
<map>
<entry key="java.naming.factory.initial" value="com.evermind.server.ApplicationClientInitialContextFactory" />
<entry key="java.naming.provider.url" value="ormi://localhost/" />
<entry key="java.naming.security.principal" value="user1" />
<entry key="java.naming.security.credentials" value="pswd2" />
</map>
</property>
<property name="weblogicAppServer">
<map>
<entry key="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory" />
<entry key="java.naming.provider.url" value="t3://localhost/" />
<entry key="java.naming.security.principal" value="user2" />
<entry key="java.naming.security.credentials" value="pswd2" />
</map>
</property>
</bean>

Mat
 
Don't get me started about those stupid light bulbs.
 
subject: Spring injection problem