微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spring – 来自其他Jar的存储库为null.如何初始化?

我有一个项目在一个项目中进行数据访问,并在另一个项目中用作spring jar.我使用gradle maven-publish插件创建了jar.我在我的其他项目测试用例中初始化了这个Jar

@ContextConfiguration(locations = {"classpath*:spring-config.xml"})
@Transactional
public class TenantProvisioningManagerTest extends AbstractTestNGSpringContextTests {}

使用存储库的类.我这样用过

public class TenantProvisioningManager {

    private static final Logger logger = LogManager.getLogger(TenantProvisioningManager.class);

    @Autowired
    TProductRepository tProductRepository;
}

存储库在这里为空.如何在这个单独的项目中从其他jar初始化存储库?

春天-config.xml文件

spring-beans.xsd
              http://www.springframework.org/schema/tx
              http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/data/jpa
              http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
              ">
property-placeholder
        location="file://#{systemEnvironment['GRADLE_USER_HOME']}/gradle.properties"/>

                
                                 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐