Solved

Injecting static variables

Posted on 2014-01-22
4
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 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:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

752 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