-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#139): To ensure compatibility with Spring proxy, utilize JDK pro…
…xy instead of Byte Buddy when creating the mapper proxy.
- Loading branch information
GangCheng
committed
Jan 20, 2024
1 parent
9ec5863
commit 0bb852e
Showing
5 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...ive/mybatis/support/r2dbc/spring/application/mapper/repository/SimpleQueryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2009-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.repository; | ||
|
||
import org.springframework.stereotype.Repository; | ||
import reactor.core.publisher.Mono; | ||
|
||
/** | ||
* @author Gang Cheng | ||
* @version 1.0.0 | ||
* @since 1.0.0 | ||
*/ | ||
@Repository | ||
public interface SimpleQueryRepository { | ||
|
||
Mono<Long> countAllDept(); | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...ctive/mybatis/support/r2dbc/spring/test/mapper/repository/SimpleQueryRepositoryTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2009-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.mapper.repository; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.MybatisR2dbcApplication; | ||
import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.repository.SimpleQueryRepository; | ||
import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.MybatisR2dbcApplicationTests; | ||
import reactor.test.StepVerifier; | ||
|
||
/** | ||
* @author Gang Cheng | ||
* @version 1.0.0 | ||
* @since 1.0.0 | ||
*/ | ||
@SpringBootTest(classes = MybatisR2dbcApplication.class) | ||
public class SimpleQueryRepositoryTests extends MybatisR2dbcApplicationTests { | ||
|
||
@Autowired | ||
SimpleQueryRepository simpleQueryRepository; | ||
|
||
@Test | ||
void countAll() { | ||
simpleQueryRepository.countAllDept() | ||
.as(StepVerifier::create) | ||
.expectNext(4L) | ||
.verifyComplete(); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
mybatis-r2dbc-spring/src/test/resources/mapper/repository/SimpleQueryRepository.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.repository.SimpleQueryRepository"> | ||
|
||
<select id="countAllDept" resultType="java.lang.Long"> | ||
SELECT COUNT(*) FROM dept | ||
</select> | ||
|
||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters