Skip to content

Commit

Permalink
Merge pull request #289 from hazendaz/master
Browse files Browse the repository at this point in the history
Type bean as an object and update comments on aquillian usage
  • Loading branch information
hazendaz authored Mar 31, 2022
2 parents 9967a7d + 53e3c98 commit 6e76fa0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Testing with Arquillian

In order to test with Arquillian, one class needs to be added to 'JavaArchive' in order for this to load properly. Add 'SqlSessionManagerRegistry.class'.

See attachment on https://github.com/mybatis/cdi/issues/86 from 2021-12-30 ArqullianMybatisExample.zip [here](https://github.com/mybatis/cdi/files/7795050/ArquillianMybatisExample.zip)
See attachment on https://github.com/mybatis/cdi/issues/86 from 2021-12-30 ArquillianMybatisExample.zip [here](https://github.com/mybatis/cdi/files/7795050/ArquillianMybatisExample.zip). This is to be run under jdk 8 to be error free but will run as-is under jdk 11 with an invocation error which still allows it to run. Further updates are needed to get this code example current.

Essentials
----------
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/mybatis/cdi/MyBatisBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* @author Frank D. Martinez [mnesarco]
*/
public class MyBatisBean implements Bean, Serializable, PassivationCapable {
public class MyBatisBean implements Bean<Object>, Serializable, PassivationCapable {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -124,17 +124,17 @@ public Set<InjectionPoint> getInjectionPoints() {
}

@Override
public Object create(CreationalContext creationalContext) {
public Object create(CreationalContext<Object> creationalContext) {
if (SqlSession.class.equals(this.type)) {
return findSqlSessionManager(creationalContext);
}
ErrorContext.instance().reset();
return Proxy.newProxyInstance(SqlSessionFactory.class.getClassLoader(), new Class[] { this.type },
new SerializableMapperProxy(this, creationalContext));
new SerializableMapperProxy<Object>(this, creationalContext));
}

@Override
public void destroy(Object instance, CreationalContext creationalContext) {
public void destroy(Object instance, CreationalContext<Object> creationalContext) {
creationalContext.release();
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/mybatis/cdi/MybatisExtensionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void mappersFoundAfterTheBeanUsingTheMapperInAnInjectionPointHasBeenScannedShoul
AfterBeanDiscovery afterBeanDiscovery = mock(AfterBeanDiscovery.class);
extension.afterBeanDiscovery(afterBeanDiscovery);

verify(afterBeanDiscovery).addBean((Bean<?>) any());
verify(afterBeanDiscovery).addBean((Bean<Object>) any());

}

Expand Down

0 comments on commit 6e76fa0

Please sign in to comment.