У меня есть файл settings.xml в папке user_directory/.m2
. Я установил свойство в settings.xml
. Я хочу, чтобы он получил к нему доступ в spring.xml
.
настройка.xml
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<testName>Test</testName>
</properties>
</profile>
</profiles>
в pom.xml я написал
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
Должен ли я создать файл test.properties
внутри папки src/main/resources.
name = ${testName}
В spring.xml
я использовал его как
<context:property-placeholder location="classpath:src/main/resources/test.properties"/>
<bean class="java.lang.String" id="nameTest">
<constructor-arg value="name"/>
</bean>
Когда run.Exception
Исключение в потоке «основной» org.springframework.beans.factory.BeanInitializationException: не удалось загрузить свойства; вложенным исключением является java.io.FileNotFoundException: ресурс пути к классу [src/main/resources/test.properties] не может быть открыт, поскольку он не существует
Что происходит не так. Как я могу получить доступ к свойствам от settings.xml
до spring.xml
.