Monthly Archives: August 2013

XBeanNamespaceHandler for namespace

Encountered this warning on my <amq:connectionFactory> element while using Eclipse STS to setup Spring-Integration: NamespaceHandler class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] for namespace [http://activemq.apache.org/schema/core]  not found. Check Error Log for more details. To resolve, add the following to pom.xml: <apache.activemq.version>5.5.0</apache.activemq.version> Dependency:         <dependency>

Tagged with: , , ,
Posted in Spring Integration

Git commands

Useful Git commands Get short hash (6 digit) git rev-parse –short <version> # HEAD for current Remove un-tracked files from working directory (link) git clean -f #remove ignored files git clean -f -d #remove ingnore files & directories git clean

Tagged with:
Posted in Git

Spring – multiple contexts

Spring MVC normally contains several xml files for configuration: web.xml – required for java web aplications (used to configure following two) applicatonContext.xml  – defines the root context (shared by all) location & name is specified by the contextConfigLocation property in

Tagged with: , , ,
Posted in Spring, Spring MVC

Read Properties from file

Add following config to applicationContext.xml: <context:property-placeholder location=”classpath*:*.properties” /> Reference using ${} notation: ${webapp.url} Or, Inject directly into bean: @Value(${webapp.url:optionalDefaultValue}) Note 1: Having more than placeholder in the same application context will lead to Runtime error unless ignoreUnresolvablePlaceholders is set to true.

Posted in Spring

Spring MessageSource

How to use Spring MessageSource: org.springframework.context.MessageSource # interface org.springframework.context.support.ResourceBundleMessageSource #impl Add to Maven: <dependency>     <groupId>org.springframework</groupId>     <artifactId>spring-context-support</artifactId>     <version>3.2.4.RELEASE</version> </dependency> XML:   <bean id=”messageSource”         class=”org.springframework.context.support.ResourceBundleMessageSource”>     <property name=”basename” value=”messages”/> Add messages.properties to classpath Use in POJO: @Autowired private MessageSource messageSource; …. messageSource.getMessage(lookup_code, args, Locale.ENGLISH)

Tagged with: , ,
Posted in Spring