"version.tagx"라는 tagx 파일을 정의하고 있습니다. 이 태그의 책임은 표시 텍스트가 응용 프로그램의 버전 번호 인 앵커 태그를 내보내는 것입니다. 현재 파일의 정의는 다음과 같습니다tagx/jspx에서 시스템 속성을 읽으려면 어떻게해야합니까?
<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:spring="http://www.springframework.org/tags" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:output omit-xml-declaration="yes" />
<jsp:directive.attribute name="render" type="java.lang.Boolean" required="false" rtexprvalue="true" description="Indicate if the contents of this tag and all enclosed tags should be rendered (default 'true')" />
<c:if test="${empty render or render}">
<spring:message code="global_version" />
<spring:url var="changelog" value="/resources/changelog.txt" />
<c:out value=": " />
<a href="${changelog}" title="Built by ${application_builtBy} on ${application_buildTime}">${application_version}</a>
</c:if>
</jsp:root>
내 응용 프로그램이 톰캣 7 배 용기의 스프링 MVC 응용 프로그램을 실행합니다. 나는 내가 app-info.properties 파일이 봄에 의해 발견 디버그 로그 메시지를 다음을 통해 확인했다
<context:property-placeholder location="classpath*:META-INF/spring/*_${spring.profiles.active}.properties,classpath:app-info.properties"/>
내 applicationContext.xml에서 다음 줄을이 (아마도) 그 파일 내에서 속성 값은로드 된 내 런타임에. 여기
는2012-05-09 23:45:24,237 [main] INFO org.springframework.context.support.PropertySourcesPlaceholderConfigurer - Loading properties file from class path resource [app-info.properties]
2012-05-09 23:45:24,237 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [localProperties] PropertySource with lowest search precedence
그리고 여기 내 app-info.properties 파일의 내용입니다 로그 메시지입니다 : 내 tagx이 방출하는
application_version=1.0
application_buildTime=05-04-2012 00:00:00
application_builtBy=me
application_buildNumber=55
내가 원하는 것은
Version: <a href="path/to/changelog.html" title="Built by me on 05-04-2012 00:00:00">1.0</a>
현재 내가 얻는 것은 :
Version: <a href="path/to/changelog.html" title="Built by on "></a>
누구든지이 작업을 수행하는 방법을 알고 있습니까? 속성 파일을 모두 포기하는 완전히 다른 접근 방식을 시도해야합니까? webmvc-config.xml 파일의 추가 폴더의 유틸리티에서
달콤한 ! 나는이 문제를 게시하고 그 사이에 추한 일에 의존해 왔기 때문에 나는이 문제로 고심하고있다. 통찰력을 정말로 고맙게 생각합니다! 어떻게 대답을 알 수 있었는지 물어봐도 될까요? 북마크를 유지해야하는 어딘가에 좋은 문서가 있습니까? –
웹 MVC 프레임 워크 참조 설명서 (http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html)는 mvc : resources 경로를 변경하는 좋은 예에서 applicationProps를 사용합니다. application.version에서. 이는 새 버전이 배포 될 때 javascript 및 기타 리소스가 업데이트되도록해야 할 때 유용합니다. 이 구성이 없으면 브라우저의 캐시에서 javascript가 업데이트되지 않습니다. – jalcalav