我甚至不確定這是否是版本不兼容,但基於我的搜索似乎是這樣的。 那麼,我正在升級我的項目上的一些插件,它似乎是一些版本問題,因爲與舊版本,一切都按預期工作,並與新的我得到這些錯誤。 MyBatis的我應該在Spring 4.1.6中使用哪個正確的版本?
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.1.1</version>
</dependency>
的Apache CXF其中CXF版本是:3.1.4
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-management</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-local</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-local</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>3.0.0-milestone1</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
</exclusions>
</dependency>
,春春在那裏的版本是:4.1.6.RELEASE
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring-version}</version>
</dependency>
這是我現在擁有的配置。我能夠運行大部分測試,並且他們正在通過。正如預期的那樣,豆類正在填充,一切都很好。 但有一個測試失敗。在這個測試中,我有這樣的:
public class JdeQueryServiceCxfTest extends AbstractTestCxf {
@Autowired
@Qualifier("jdeQueryServiceClient")
private QueryService ws;
進入我的QueryService的我有這樣的:
@WebService(endpointInterface = "myEndpoint.rs.QueryService")
@Service("queryService")
public class JdeQueryServiceImpl implements QueryService {
@Autowired(required=true)
@Qualifier("sqlSession")
SqlSessionTemplate sqlSession;
@Autowired(required=true)
@Qualifier("jdeObjectMapper")
JdeObjectMapper jdeObjectMapper;
而且我的測試調用此方法:
@SuppressWarnings("unchecked")
@Override
public List<RateSheet> getObjectGroups(ObjectMarkupTbl markup) throws Exception {
使用此:
@Test
public void testObjectByGroup() throws Exception {
List<RateSheet> rateSheets = ws.getObjectGroups(ObjectMarkupTbl.create(effectiveDate, "0222", "", "20151234", ""));
Assert.assertNotNull(rateSheets);
通過將一些日誌信息添加到getObjectGroups
我看到ObjectMarkupTbl
字段爲空。
到控制檯輸出,我可以看到這一點:
[main][2015-12-14 13:27:43,768] o.s.b.f.s.DefaultListableBeanFactory WARN Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdeObjectMapper' defined in URL [jar:file:/Users/myuser/.m2/repository/com/project/16.02.RC1-SNAPSHOT/specs-16.02.RC1-SNAPSHOT.jar!/com/project/mapper/JdeObjectMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
我知道這是一個大人物在這裏加入這個具體問題,但也許有人已經經歷過這樣的事情,可以給我一些建議關於哪個版本我用它來使它工作。
他們的文檔說什麼? – ochi
我看到cxf 3.1.4可以在4.1.6版本下運行,但是找不到myBatis。也不確定他們中哪些是造成問題。 – Igor
聽起來像你可能需要升級mybatis。更新的版本似乎支持它:(http://blog.lanyonm.org/articles/2014/04/21/spring-4-mybatis-java-config.html) – ochi