Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在汇流插件中将属性从文件读取到spring上下文_Spring_Maven_Osgi_Confluence - Fatal编程技术网

在汇流插件中将属性从文件读取到spring上下文

在汇流插件中将属性从文件读取到spring上下文,spring,maven,osgi,confluence,Spring,Maven,Osgi,Confluence,我正在尝试将属性文件读入汇流插件中的spring上下文。我已将以下上下文文件添加到META-INF/spring: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:atlassian-spring=

我正在尝试将属性文件读入汇流插件中的spring上下文。我已将以下上下文文件添加到META-INF/spring:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:atlassian-spring="http://www.atlassian.com/schema/atlassian-spring"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.atlassian.com/schema/atlassian-spring http://www.atlassian.com/schema/atlassian-spring/atlassian.xsd">

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="db.properties"/>
    </bean>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="url" value="${db.url}" />
        <property name="driverClassName" value="${db.driver}" />
        <property name="username" value="${db.user}" />
        <property name="password" value="${db.password}" />
    </bean></beans>

在pom.xml中,我还添加了以下依赖项:

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>2.5.6.SEC02</version>
        <scope>provided</scope>
    </dependency>

org.springframework
我发现我应该将导入包添加到atlassian-plugin.xml中的SpringBeans包中,但添加以下内容:

<bundle-instructions>
        <Import-Package>org.springframework.beans*</Import-Package>
    </bundle-instructions>

org.springframework.beans*
没有帮助。
有什么建议吗?

上面提到的spring版本有OSGI捆绑包吗?你能证实吗?因为有些spring版本没有OSGI捆绑包。在这种情况下,您需要自己转换为bundle。如果不是OSGI包。那个么包就不会被暴露,类也就无法找到,所以你们会得到上面的错误

关于spring OSGI捆绑包的一些细节


我找到了我问题的答案。为了在confluence中配置OSGI,应该配置maven插件:

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-***-plugin</artifactId> <!-- *** is the name of the application (product) you're using -->
    <version>3.2.3</version>
    <extensions>true</extensions>
    <configuration>
      <productVersion>${product.version}</productVersion>
      <instructions>
        <!-- OSGi instructions go here -->
      </instructions>
    </configuration>
  </plugin>

com.atlassian.maven.plugins
maven-***-插件
3.2.3
符合事实的
${product.version}

然后把进口包装声明放在那里

查看您提供的链接和您拥有的内容,您似乎缺少了一个
。我想应该是
org.springframework.beans,*