Skip to content

Commit

Permalink
Merge pull request #576 from sgdesmet/feat/guice7
Browse files Browse the repository at this point in the history
Jakarta namespace and Guice 7
  • Loading branch information
christianpoitras authored Sep 21, 2023
2 parents 90b578a + 08f916d commit f1fa3d3
Show file tree
Hide file tree
Showing 77 changed files with 414 additions and 389 deletions.
37 changes: 27 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
<clirr.comparisonVersion>3.10</clirr.comparisonVersion>
<spotbugs.onlyAnalyze>org.mybatis.guice.*</spotbugs.onlyAnalyze>
<gcu.product>Guice</gcu.product>
<guice.version>5.1.0</guice.version>
<guice.version>7.0.0</guice.version>
<annotation-api.version>1.3.5</annotation-api.version>
<ejb-api.version>3.2.6</ejb-api.version>
<inject-api.version>1.0.5</inject-api.version>
<inject-api.version>2.0.1</inject-api.version>
<osgi.import>com.alibaba.druid.pool.*;resolution:=optional,com.zaxxer.hikari.*;resolution:=optional,com.mchange.v2.c3p0.*;resolution:=optional,org.apache.commons.dbcp2.*;resolution:=optional,javax.transaction.*;resolution:=optional</osgi.import>
<spotbugs.omitVisitors>UnreadFields</spotbugs.omitVisitors>
<module.name>org.mybatis.guice</module.name>
Expand Down Expand Up @@ -221,7 +221,7 @@
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>1.3.3</version>
<version>2.0.1</version>
<optional>true</optional>
</dependency>

Expand Down Expand Up @@ -289,16 +289,33 @@
</dependency>

<dependency>
<groupId>org.apache.aries.transaction</groupId>
<artifactId>org.apache.aries.transaction.jdbc</artifactId>
<version>2.1.3</version>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>narayana-jta</artifactId>
<version>7.0.0.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.aries.transaction</groupId>
<artifactId>org.apache.aries.transaction.blueprint</artifactId>
<version>2.3.1</version>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-logging</artifactId>
<version>21.1.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.agroal</groupId>
<artifactId>agroal-api</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.agroal</groupId>
<artifactId>agroal-pool</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.agroal</groupId>
<artifactId>agroal-narayana</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/mybatis/guice/MyBatisJtaModule.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -15,15 +15,8 @@
*/
package org.mybatis.guice;

import static com.google.inject.matcher.Matchers.annotatedWith;
import static com.google.inject.matcher.Matchers.any;
import static com.google.inject.matcher.Matchers.not;
import static org.mybatis.guice.Preconditions.checkArgument;

import javax.inject.Provider;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;

import jakarta.inject.Provider;
import jakarta.transaction.TransactionManager;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.apache.ibatis.transaction.TransactionFactory;
Expand All @@ -34,6 +27,13 @@
import org.mybatis.guice.transactional.TxTransactionalMethodInterceptor;
import org.mybatis.guice.transactional.XASqlSessionManagerProvider;

import javax.transaction.xa.XAResource;

import static com.google.inject.matcher.Matchers.annotatedWith;
import static com.google.inject.matcher.Matchers.any;
import static com.google.inject.matcher.Matchers.not;
import static org.mybatis.guice.Preconditions.checkArgument;

public abstract class MyBatisJtaModule extends MyBatisModule {
private final Log log = LogFactory.getLog(getClass());

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/mybatis/guice/MyBatisModule.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -23,10 +23,11 @@
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;

import jakarta.inject.Provider;

import java.util.Collection;
import java.util.Set;

import javax.inject.Provider;
import javax.sql.DataSource;

import org.apache.ibatis.io.ResolverUtil;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -17,12 +17,13 @@

import com.google.inject.ProvisionException;

import jakarta.inject.Named;
import jakarta.inject.Provider;
import jakarta.inject.Singleton;

import java.util.HashSet;
import java.util.Set;

import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
import javax.sql.DataSource;

import org.apache.ibatis.executor.ErrorContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -17,8 +17,8 @@

import com.google.inject.Injector;

import javax.inject.Inject;
import javax.inject.Provider;
import jakarta.inject.Inject;
import jakarta.inject.Provider;

import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -18,8 +18,8 @@
import com.google.inject.Injector;
import com.google.inject.Key;

import javax.inject.Inject;
import javax.inject.Provider;
import jakarta.inject.Inject;
import jakarta.inject.Provider;

import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -17,8 +17,8 @@

import com.google.inject.Injector;

import javax.inject.Inject;
import javax.inject.Provider;
import jakarta.inject.Inject;
import jakarta.inject.Provider;

import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.session.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -17,8 +17,8 @@

import com.google.inject.Injector;

import javax.inject.Inject;
import javax.inject.Provider;
import jakarta.inject.Inject;
import jakarta.inject.Provider;

import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.apache.ibatis.session.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -18,8 +18,8 @@
import com.google.inject.Injector;
import com.google.inject.Key;

import javax.inject.Inject;
import javax.inject.Provider;
import jakarta.inject.Inject;
import jakarta.inject.Provider;

import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -15,11 +15,12 @@
*/
package org.mybatis.guice.datasource.builtin;

import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Provider;

import java.util.Properties;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.naming.Context;
import javax.sql.DataSource;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -15,11 +15,12 @@
*/
package org.mybatis.guice.datasource.builtin;

import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Provider;

import java.util.Properties;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.sql.DataSource;

import org.apache.ibatis.datasource.pooled.PooledDataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -15,11 +15,12 @@
*/
package org.mybatis.guice.datasource.builtin;

import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Provider;

import java.util.Properties;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.sql.DataSource;

import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -17,12 +17,13 @@

import com.mchange.v2.c3p0.ComboPooledDataSource;

import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Provider;

import java.beans.PropertyVetoException;
import java.util.Properties;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.sql.DataSource;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -15,12 +15,13 @@
*/
package org.mybatis.guice.datasource.dbcp;

import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Provider;

import java.util.Map.Entry;
import java.util.Properties;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.sql.DataSource;

import org.apache.commons.dbcp2.BasicDataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -15,9 +15,10 @@
*/
package org.mybatis.guice.datasource.dbcp;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Provider;

import javax.sql.ConnectionPoolDataSource;

import org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
Expand All @@ -19,11 +19,11 @@
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;

import jakarta.inject.Provider;

import java.lang.annotation.Annotation;
import java.util.Map;

import javax.inject.Provider;

public final class PerUserPoolDataSourceModule extends AbstractModule {

private static final TypeLiteral<Map<String, Boolean>> STRING_BOOLEAN_MAP = new TypeLiteral<Map<String, Boolean>>() {
Expand Down
Loading

0 comments on commit f1fa3d3

Please sign in to comment.