Skip to content

Instantly share code, notes, and snippets.

@darbyluv2code
Created January 23, 2017 17:00
Show Gist options
  • Select an option

  • Save darbyluv2code/d4b21395ad6ecaed6dbf9f74ca230b8b to your computer and use it in GitHub Desktop.

Select an option

Save darbyluv2code/d4b21395ad6ecaed6dbf9f74ca230b8b to your computer and use it in GitHub Desktop.
Spring MVC Demo - Read country options from properties file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
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
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!-- Step 3: Add support for component scanning -->
<context:component-scan base-package="com.luv2code.springdemo" />
<!-- Step 4: Add support for conversion, formatting and validation support -->
<mvc:annotation-driven/>
<!-- Step 5: Define Spring MVC view resolver -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
<util:properties id="countryOptions" location="classpath:../countries.properties" />
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment