Skip to content

Instantly share code, notes, and snippets.

@JensMeiners
Last active May 2, 2016 12:11
Show Gist options
  • Save JensMeiners/5356d442c8ad5c785528b9689e7ec12c to your computer and use it in GitHub Desktop.
Save JensMeiners/5356d442c8ad5c785528b9689e7ec12c to your computer and use it in GitHub Desktop.
Simple Spring Setup
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="crawler" class="de.berlin.tu.Crawler">
<property name="indexServer" value="somewhereimportant.tu-berlin.de"></property>
<property name="indexPort" value="9999"></property>
</bean>
<bean id="readerlist" class="java.util.ArrayList">
<constructor-arg>
<list>
<ref bean="first" />
<ref bean="second" />
<ref bean="third" />
</list>
</constructor-arg>
</bean>
<bean id="first" class="de.berlin.tu.rss.ConfigRSSReader">
<constructor-arg name="author" value="dc:creator" />
<constructor-arg name="desc" value="description" />
<constructor-arg name="title" value="title" />
<constructor-arg>
<list>
<value>http://www.firstrss.de</value>
<value>http://www.secondrss.de/rss/</value>
</list>
</constructor-arg>
</bean>
</beans>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
public static ApplicationContext context = new ClassPathXmlApplicationContext("config.xml");
List<ConfigRSSReader> readerList = (List<ConfigRSSReader>) context.getBean("readerlist");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment