?
Solved

Basic Question: Dynamic Java Classloading

Posted on 2010-11-13
4
Medium Priority
?
458 Views
Last Modified: 2012-05-10
Hi there,

i have a basic question, because i'm a java beginner:
Im working on a web project and my servlet needs to access some data from some "information-provider".
I want to write my servlet independend to the information-provider so i'm building a "info-bridge" bean which implements an interface.

I want to use an XML file, where i can configure what "info-bridge" java bean should be used (a bit like the spring-bean config stuff).

So i have the following XML:
<config>
  <information-interface class="myJavaPackage.myProject.bridges.provider1Bridge" />
<config>

What is the best way to load the class from my servlet? Is it Java Reflection or is there any other technique (because i read that java reflection is not very fast) or is there maybe any built-in feature of apache tomcat? What is common??


thx for your help and best regards
manuel
0
Comment
Question by:mesX
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 34127287
Reflection is fine - you shouldn't have to load the class very often anyway
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 34129006
0
 

Author Closing Comment

by:mesX
ID: 34134289
Thx for your quick responses and Tips!


regards!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34134984
:)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question