我想提出一個春天4.1.4 REST服務,並部署它到WebSphere Application Server 8在我的本地Windows 7訪問的WebSphere 8 shareLib路徑FRIM的Spring Java代碼
我創建瞭如下份額lib和放棄其refernce的尊重戰爭文件 sharedLib configuration
在該位置我保持我的財產文件/abc/application.properties
loaction of the abc folder in APPSERVER
代碼: 我試圖加載該文件,如下面的彈簧rest.xml
<bean id="fileSystemResource" class="org.springframework.core.io.FileSystemResource">
<constructor-arg value="#{systemProperties['sharedLib']}/abc/">
</constructor-arg>
</bean>
<bean id="propertyLoader" name="propertyLoader" class="com.framework.RuntimeEnvironmentPropertiesConfigurer">
<property name="propertyLocation" ref="fileSystemResource" />
</bean>
我propertyloader類:這是工作的罰款:::
public class RuntimeEnvironmentPropertiesConfigurer extends PropertyPlaceholderConfigurer implements InitializingBean,RuntimeEnvironmentInterface {
/** The Environment */
public String environment;
/** The Property Location */
public FileSystemResource propertyLocation;
但可悲的是,這是在尋找ABC文件夾我的C:/驅動器。
如果我在C:/abc/application.properties中保留以下內容,那麼我的應用程序屬性被抓取。並且應用程序正常運行因此加載Bean時沒有問題。
也給我的依賴在pom.xml,不知道如果我需要添加任何其他依賴項。
<properties>
<springframework.version>4.1.4.RELEASE</springframework.version>
<jackson.library>2.7.5</jackson.library>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>mail</artifactId>
<groupId>javax.mail</groupId>
</exclusion>
<exclusion>
<artifactId>jms</artifactId>
<groupId>javax.jms</groupId>
</exclusion>
<exclusion>
<artifactId>jmxtools</artifactId>
<groupId>com.sun.jdmk</groupId>
</exclusion>
<exclusion>
<artifactId>jmxri</artifactId>
<groupId>com.sun.jmx</groupId>
</exclusion>
</exclusions>
</dependency>
但我需要獲取從共享庫位置的路徑。 任何人都可以幫我指出我失蹤的東西嗎? 請提供答案我如何在春季實現這一點。
'sharedLib'是JVM自定義屬性?你有你的Spring xml配置中創建的'RuntimeEnvironmentPropertiesConfigurer'類的實例嗎? – dbreaux
@dbreaux「sharedLib」是我在WAS環境變量中創建的共享庫的名稱,它包含我保留屬性File的路徑。是的,我有一個在我的Spring xml中創建的RuntimeEnvironmentPropertiesConfigurer類的實例...我想從sharedLib加載路徑。 – juneSakura
編輯的spring-rest.xml代碼片段..plz參考:) @dbreaux – juneSakura