diff --git a/docs/spring/cs4b17d13c-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4b17d13c-a90f-11ee-b0cd-acde48001122.java new file mode 100644 index 00000000..6e582685 --- /dev/null +++ b/docs/spring/cs4b17d13c-a90f-11ee-b0cd-acde48001122.java @@ -0,0 +1,9 @@ +package dolores.oauthserver.config; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableConfigurationProperties(OAuth2Properties.class) +public class OAuth2CoreConfig { +} diff --git a/docs/spring/cs4b508e0a-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4b508e0a-a90f-11ee-b0cd-acde48001122.java new file mode 100644 index 00000000..1059332b --- /dev/null +++ b/docs/spring/cs4b508e0a-a90f-11ee-b0cd-acde48001122.java @@ -0,0 +1,40 @@ +/** + * Copyright 2009-2018 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 + *
+ * http://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 org.apache.ibatis.session; + +import java.sql.Connection; + +/** + * 事物级别, 封装 java.sql 的事物美剧 + * @author Clinton Begin + */ +public enum TransactionIsolationLevel { + NONE(Connection.TRANSACTION_NONE), + READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED), + READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED), + REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ), + SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE); + + private final int level; + + TransactionIsolationLevel(int level) { + this.level = level; + } + + public int getLevel() { + return level; + } +} diff --git a/docs/spring/cs4b881c6c-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4b881c6c-a90f-11ee-b0cd-acde48001122.java new file mode 100644 index 00000000..8b0c22ce --- /dev/null +++ b/docs/spring/cs4b881c6c-a90f-11ee-b0cd-acde48001122.java @@ -0,0 +1,74 @@ +/** + * Copyright 2009-2018 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 + *
+ * http://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 org.apache.ibatis.jdbc; + +import org.apache.ibatis.type.*; + +/** + * 对于 null 不同类型的描述, {类型处理器,jdbc类型} + * @author Clinton Begin + * @author Adam Gent + */ +public enum Null { + BOOLEAN(new BooleanTypeHandler(), JdbcType.BOOLEAN), + + BYTE(new ByteTypeHandler(), JdbcType.TINYINT), + SHORT(new ShortTypeHandler(), JdbcType.SMALLINT), + INTEGER(new IntegerTypeHandler(), JdbcType.INTEGER), + LONG(new LongTypeHandler(), JdbcType.BIGINT), + FLOAT(new FloatTypeHandler(), JdbcType.FLOAT), + DOUBLE(new DoubleTypeHandler(), JdbcType.DOUBLE), + BIGDECIMAL(new BigDecimalTypeHandler(), JdbcType.DECIMAL), + + STRING(new StringTypeHandler(), JdbcType.VARCHAR), + CLOB(new ClobTypeHandler(), JdbcType.CLOB), + LONGVARCHAR(new ClobTypeHandler(), JdbcType.LONGVARCHAR), + + BYTEARRAY(new ByteArrayTypeHandler(), JdbcType.LONGVARBINARY), + BLOB(new BlobTypeHandler(), JdbcType.BLOB), + LONGVARBINARY(new BlobTypeHandler(), JdbcType.LONGVARBINARY), + + OBJECT(new ObjectTypeHandler(), JdbcType.OTHER), + OTHER(new ObjectTypeHandler(), JdbcType.OTHER), + TIMESTAMP(new DateTypeHandler(), JdbcType.TIMESTAMP), + DATE(new DateOnlyTypeHandler(), JdbcType.DATE), + TIME(new TimeOnlyTypeHandler(), JdbcType.TIME), + SQLTIMESTAMP(new SqlTimestampTypeHandler(), JdbcType.TIMESTAMP), + SQLDATE(new SqlDateTypeHandler(), JdbcType.DATE), + SQLTIME(new SqlTimeTypeHandler(), JdbcType.TIME); + + /** + * 类型处理器 + */ + private TypeHandler> typeHandler; + /** + * jdbc 类型 + */ + private JdbcType jdbcType; + + Null(TypeHandler> typeHandler, JdbcType jdbcType) { + this.typeHandler = typeHandler; + this.jdbcType = jdbcType; + } + + public TypeHandler> getTypeHandler() { + return typeHandler; + } + + public JdbcType getJdbcType() { + return jdbcType; + } +} diff --git a/docs/spring/cs4bbe87d4-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4bbe87d4-a90f-11ee-b0cd-acde48001122.java new file mode 100644 index 00000000..96a1f336 --- /dev/null +++ b/docs/spring/cs4bbe87d4-a90f-11ee-b0cd-acde48001122.java @@ -0,0 +1,35 @@ +package com.huifer.design.proxy.cglib; + +import net.sf.cglib.proxy.Enhancer; +import net.sf.cglib.proxy.MethodInterceptor; +import net.sf.cglib.proxy.MethodProxy; + +import java.lang.reflect.Method; + +/** + *
Title : CGLIBZhiLian
+ *Description :
+ * + * @author huifer + * @date 2019-05-17 + */ +public class CGLIBZhiLian { + + public Object getInstance(Class> clazz) throws Exception { + Enhancer enhancer = new Enhancer(); + enhancer.setSuperclass(clazz); + + enhancer.setCallback(new MethodInterceptor() { + @Override + public Object intercept(Object o, Method method, Object[] args, + MethodProxy methodProxy) throws Throwable { + System.out.println("CGLIB 代理智联"); + Object o1 = methodProxy.invokeSuper(o, args); + return o1; + } + }); + + return enhancer.create(); + + } +} diff --git a/docs/spring/cs4bf48604-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4bf48604-a90f-11ee-b0cd-acde48001122.java new file mode 100644 index 00000000..72ddd356 --- /dev/null +++ b/docs/spring/cs4bf48604-a90f-11ee-b0cd-acde48001122.java @@ -0,0 +1,141 @@ +/** + * Copyright 2009-2019 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 + *
+ * http://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 org.apache.ibatis.logging; + +import java.lang.reflect.Constructor; + +/** + *
日志工厂,实现内容:
+ *+ * 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 + *
+ * http://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. + *
+ * Hyper-simple Datasource. + */ +/** + * Hyper-simple Datasource. + */ +package org.apache.ibatis.datasource.unpooled; diff --git a/docs/spring/cs4c958d4c-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4c958d4c-a90f-11ee-b0cd-acde48001122.java new file mode 100644 index 00000000..707887fa --- /dev/null +++ b/docs/spring/cs4c958d4c-a90f-11ee-b0cd-acde48001122.java @@ -0,0 +1,57 @@ +/** + * Copyright 2009-2016 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 + *
+ * http://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 org.apache.ibatis.submitted.ancestor_ref;
+
+import java.util.List;
+
+public class User {
+ private Integer id;
+ private String name;
+ private User friend;
+ private List
+ * 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
+ *
+ * http://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.
+ *
+ * Base package for Datasources
+ */
+/**
+ * Base package for Datasources
+ */
+package org.apache.ibatis.datasource;
diff --git a/docs/spring/cs4d03e800-a90f-11ee-b0cd-acde48001122.java b/docs/spring/cs4d03e800-a90f-11ee-b0cd-acde48001122.java
new file mode 100644
index 00000000..4943128e
--- /dev/null
+++ b/docs/spring/cs4d03e800-a90f-11ee-b0cd-acde48001122.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2009-2019 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
+ *
+ * http://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 org.apache.ibatis.cache;
+
+import org.apache.ibatis.cache.decorators.SerializedCache;
+import org.apache.ibatis.cache.decorators.WeakCache;
+import org.apache.ibatis.cache.impl.PerpetualCache;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class WeakCacheTest {
+
+ @Test
+ void shouldDemonstrateObjectsBeingCollectedAsNeeded() {
+ final int N = 3000000;
+ WeakCache cache = new WeakCache(new PerpetualCache("default"));
+ for (int i = 0; i < N; i++) {
+ cache.putObject(i, i);
+ if (cache.getSize() < i + 1) {
+ // System.out.println("Cache exceeded with " + (i + 1) + " entries.");
+ break;
+ }
+ if ((i + 1) % 100000 == 0) {
+ // Try performing GC.
+ System.gc();
+ }
+ }
+ assertTrue(cache.getSize() < N);
+ }
+
+ @Test
+ void shouldDemonstrateCopiesAreEqual() {
+ Cache cache = new WeakCache(new PerpetualCache("default"));
+ cache = new SerializedCache(cache);
+ for (int i = 0; i < 1000; i++) {
+ cache.putObject(i, i);
+ Object value = cache.getObject(i);
+ assertTrue(value == null || value.equals(i));
+ }
+ }
+
+ @Test
+ void shouldRemoveItemOnDemand() {
+ WeakCache cache = new WeakCache(new PerpetualCache("default"));
+ cache.putObject(0, 0);
+ assertNotNull(cache.getObject(0));
+ cache.removeObject(0);
+ assertNull(cache.getObject(0));
+ }
+
+ @Test
+ void shouldFlushAllItemsOnDemand() {
+ WeakCache cache = new WeakCache(new PerpetualCache("default"));
+ for (int i = 0; i < 5; i++) {
+ cache.putObject(i, i);
+ }
+ assertNotNull(cache.getObject(0));
+ assertNotNull(cache.getObject(4));
+ cache.clear();
+ assertNull(cache.getObject(0));
+ assertNull(cache.getObject(4));
+ }
+
+}