Solved

Basic Question: Dynamic Java Classloading

Posted on 2010-11-13
4
445 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 250 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 250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 65
jsp insert to database example 2 43
Java: anonymous class 4 29
java example issue 3 20
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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

808 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