Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Injecting static variables

Posted on 2014-01-22
4
Medium Priority
?
234 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 1500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

824 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