Created
February 4, 2013 06:52
-
-
Save relax-more/4705334 to your computer and use it in GitHub Desktop.
java SpringFramework Controller の変数にannotationを利用して値を設定する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
any.property.value=value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://www.springframework.org/schema/beans" | |
xsi:schemaLocation=" | |
http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans.xsd | |
"> | |
<bean id="anyProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> | |
<property name="locations"> | |
<list> | |
<value>classpath:resources/properties/any.properties</value> | |
</list> | |
</property> | |
</bean> | |
</beans> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeController{ | |
@Value(value = "#{anyProperties['any.property.value']}") | |
private String value; | |
// 中略 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment