I have something like this:
@Configuration public class SpringConfigUtil { private static final Logger logger = Logger.getLogger(SpringConfigUtil.class); @Value("#{ systemProperties['activemq.username'] }") private String userName; @Value("#{ systemProperties['activemq.password'] }") private String password; @Value("#{ systemProperties['activemq.URL'] }") private String brokerURL; @Value("#{ systemProperties['activemq.queueName'] }") private String queueName; @Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } @Bean(name="producer") public JmsTemplate jmsTemplate() { JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setDefaultDestination(new ActiveMQQueue(queueName)); jmsTemplate.setConnectionFactory(connectionFactory()); return jmsTemplate; } @Bean public ActiveMQConnectionFactory connectionFactory() { ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(); activeMQConnectionFactory.setBrokerURL(brokerURL); activeMQConnectionFactory.setUserName(userName); activeMQConnectionFactory.setPassword(password); return activeMQConnectionFactory; } } It works fine. Let's say I also have an applicationContext.xml file which has loaded some beans.
How do I refer to those beans here in @Configuration? I don't want to create beans programmatically again as they are already created by loading applicationContext.xml.
Let's have I have 50+ properties. Is there a better way to refer to them than defining something like the following for every property?
@Value("#{ systemProperties['activemq.URL'] }") private String brokerURL; Thanks for your time!