diff --git a/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-client/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ClientApplication.java b/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-client/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ClientApplication.java index 0b96200c5..dde21956d 100644 --- a/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-client/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ClientApplication.java +++ b/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-client/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ClientApplication.java @@ -18,8 +18,6 @@ package org.hswebframework.web.example.oauth2; -import org.hsweb.ezorm.rdb.executor.AbstractJdbcSqlExecutor; -import org.hsweb.ezorm.rdb.executor.SqlExecutor; import org.hswebframework.web.authorization.Authentication; import org.hswebframework.web.authorization.AuthenticationManager; import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService; @@ -28,23 +26,17 @@ import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Respons import org.hswebframework.web.authorization.shiro.oauth2sso.OAuth2SSOAuthorizingListener; import org.hswebframework.web.commons.entity.DataStatus; import org.hswebframework.web.commons.entity.factory.EntityFactory; -import org.hswebframework.web.dao.datasource.DatabaseType; import org.hswebframework.web.entity.oauth2.client.OAuth2ServerConfigEntity; import org.hswebframework.web.service.oauth2.client.OAuth2ServerConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.jdbc.datasource.DataSourceUtils; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.SQLException; import java.util.HashMap; import java.util.Map; @@ -122,20 +114,4 @@ public class OAuth2ClientApplication implements CommandLineRunner { } - @Bean - @ConditionalOnMissingBean(SqlExecutor.class) - public SqlExecutor sqlExecutor(DataSource dataSource) { - DataSourceHolder.install(dataSource, DatabaseType.h2); - return new AbstractJdbcSqlExecutor() { - @Override - public Connection getConnection() { - return DataSourceUtils.getConnection(dataSource); - } - - @Override - public void releaseConnection(Connection connection) throws SQLException { - DataSourceUtils.releaseConnection(connection, dataSource); - } - }; - } } diff --git a/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-server/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ServerApplication.java b/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-server/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ServerApplication.java index 3aa4de432..37d38c461 100644 --- a/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-server/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ServerApplication.java +++ b/hsweb-examples/hsweb-examples-oauth2/hsweb-examples-oauth2-server/src/main/java/org/hswebframework/web/example/oauth2/OAuth2ServerApplication.java @@ -19,15 +19,12 @@ package org.hswebframework.web.example.oauth2; import com.alibaba.fastjson.JSON; -import org.hsweb.ezorm.rdb.executor.AbstractJdbcSqlExecutor; -import org.hsweb.ezorm.rdb.executor.SqlExecutor; import org.hswebframework.web.authorization.Permission; import org.hswebframework.web.authorization.access.DataAccessConfig; import org.hswebframework.web.authorization.oauth2.server.entity.OAuth2ClientEntity; import org.hswebframework.web.authorization.simple.SimpleFieldFilterDataAccessConfig; import org.hswebframework.web.commons.entity.DataStatus; import org.hswebframework.web.commons.entity.factory.EntityFactory; -import org.hswebframework.web.dao.datasource.DatabaseType; import org.hswebframework.web.dao.oauth2.OAuth2ClientDao; import org.hswebframework.web.entity.authorization.*; import org.hswebframework.web.entity.authorization.bind.BindRoleUserEntity; @@ -39,19 +36,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.jdbc.datasource.DataSourceUtils; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; + /** * TODO 完成注释 * @@ -177,21 +169,4 @@ public class OAuth2ServerApplication implements CommandLineRunner { oAuth2ClientDao.insert(clientEntity); } - @Bean - @ConditionalOnMissingBean(SqlExecutor.class) - public SqlExecutor sqlExecutor(DataSource dataSource) { - DataSourceHolder.install(dataSource, DatabaseType.h2); - return new AbstractJdbcSqlExecutor() { - @Override - public Connection getConnection() { - return DataSourceUtils.getConnection(dataSource); - } - - @Override - public void releaseConnection(Connection connection) throws SQLException { - DataSourceUtils.releaseConnection(connection, dataSource); - } - }; - - } }