Solved

Injecting static variables

Posted on 2014-01-22
4
225 Views
Last Modified: 2014-01-24
Is it possible to inject static variables of one class into another using spring config ?
0
Comment
Question by:FranklinRaj22
4 Comments
 
LVL 1

Expert Comment

by:Smart_Kid
ID: 39802058
Can you please make it clear on what you meant by spring config.?
0
 
LVL 6

Accepted Solution

by:
Mahesh Bhutkar earned 500 total points
ID: 39802138
You can use org.springframework.beans.factory.config.MethodInvokingFactoryBean.

Add setter method to inject the value.

Check this example :- http://www.felfelworld.com/2012/07/08/how-make-spring-initialize-static-variable/
0
 

Expert Comment

by:anwarul
ID: 39802253
question not clear
0
 

Author Comment

by:FranklinRaj22
ID: 39806834
Sorry my mistake , I wanted to inject static variables from class A into Class B and wanted to do it via spring config file rather than doing it in the Class B code .

I used the below and it worked well .
util:constant static-field
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what is a "java.lang.System Property"   ? 20 57
Java JRE greater than 1.6 5 50
Windows 10 IE Certificate Issue 10 41
MySqlDump not dumping triggers 1 13
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now