develog

[Spring] properties, @Value 본문

Dev/Java

[Spring] properties, @Value

냐옴 2019. 6. 21. 14:04

my-prop.properties

prop.key1 = 123
prop.key2 = true

 

servlet.xml

<beans
    xmlns:util="http://www.springframework.org/schema/util"
>

    <util:properties id="myProp" location="classpath:properties/my-pop.properties"/>

</beans>

 

controller

@Value("#{myProp['prop.key1']}")
private String myValue1;

@Value("#{'true'.equals(myProp['prop.key2'])}")
private boolean myValue2;

'Dev > Java' 카테고리의 다른 글

[Java] MultiValueMap  (0) 2019.07.25
[Java] Optional Parameter  (0) 2019.04.12
[Java] HttpServletRequest getRemoteAddr IPv4 설정  (0) 2018.02.14
[iBatis] Dynamic SQL  (0) 2017.08.29
[Java] 캐시 무효화  (0) 2017.08.09
Comments