Skip to content

Commit 651aaf3

Browse files
committed
chore: update .gitignore to exclude log directory and clean up ReflectionTest and GetClassService comments
1 parent 05af3af commit 651aaf3

File tree

4 files changed

+3
-33
lines changed

4 files changed

+3
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
target/
22
docker/
3+
log/
34
!**/src/main/**/target/
45
.flattened-pom.xml
56

demo-mybatis/src/main/java/com/helltractor/demo/config/DataSourceConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import org.mybatis.spring.SqlSessionFactoryBean;
77
import org.springframework.beans.factory.annotation.Value;
88
import org.springframework.context.annotation.Bean;
9+
import org.springframework.context.annotation.Configuration;
910
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
1011

1112
import com.zaxxer.hikari.HikariDataSource;
1213

14+
@Configuration
1315
public class DataSourceConfiguration {
1416

1517
@Value("${spring.datasource.url}")

demo-reflection/src/test/java/com/helltractor/demo/ReflectionTest.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ public class ReflectionTest {
2222

2323
/**
2424
* 获取public和private字段
25-
*
26-
* @throws ClassNotFoundException
2725
*/
2826
@Test
2927
void getDeclaredField() throws ClassNotFoundException {
@@ -36,8 +34,6 @@ void getDeclaredField() throws ClassNotFoundException {
3634

3735
/**
3836
* 获取public字段
39-
*
40-
* @throws ClassNotFoundException
4137
*/
4238
@Test
4339
void getFields() throws ClassNotFoundException {
@@ -51,8 +47,6 @@ void getFields() throws ClassNotFoundException {
5147

5248
/**
5349
* 获取父类的字段
54-
*
55-
* @throws ClassNotFoundException
5650
*/
5751
@Test
5852
void getSuperFields() throws ClassNotFoundException {
@@ -65,9 +59,6 @@ void getSuperFields() throws ClassNotFoundException {
6559

6660
/**
6761
* 获取指定字段
68-
*
69-
* @throws ClassNotFoundException
70-
* @throws NoSuchFieldException
7162
*/
7263
@Test
7364
void getDeclaredFieldByAnnotation() throws ClassNotFoundException, NoSuchFieldException {
@@ -89,10 +80,6 @@ void getDeclaredFieldByAnnotation() throws ClassNotFoundException, NoSuchFieldEx
8980

9081
/**
9182
* 获取static字段值
92-
*
93-
* @throws ClassNotFoundException
94-
* @throws NoSuchFieldException
95-
* @throws IllegalAccessException
9683
*/
9784
@Test
9885
void getStaticField() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
@@ -111,11 +98,6 @@ void getStaticField() throws ClassNotFoundException, NoSuchFieldException, Illeg
11198

11299
/**
113100
* 获取方法
114-
*
115-
* @throws ClassNotFoundException
116-
* @throws NoSuchMethodException
117-
* @throws IllegalAccessException
118-
* @throws InvocationTargetException
119101
*/
120102
@Test
121103
void getDeclaredMethod() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
@@ -139,13 +121,6 @@ void getDeclaredMethod() throws ClassNotFoundException, NoSuchMethodException, I
139121

140122
/**
141123
* 类型转换,通过Class.cast()方法实现, 在编译时实现
142-
*
143-
* @throws ClassNotFoundException
144-
* @throws NoSuchMethodException
145-
* @throws IllegalAccessException
146-
* @throws InvocationTargetException
147-
* @throws InstantiationException
148-
* @throws NoSuchFieldException
149124
*/
150125
@Test
151126
void cast() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchFieldException {
@@ -160,12 +135,6 @@ void cast() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessE
160135

161136
/**
162137
* 类型转换, 通过使用泛型实现类型转换
163-
*
164-
* @throws ClassNotFoundException
165-
* @throws NoSuchMethodException
166-
* @throws IllegalAccessException
167-
* @throws InvocationTargetException
168-
* @throws InstantiationException
169138
*/
170139
@Test
171140
void reflect() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchFieldException {

demo-reflection/src/test/java/com/helltractor/demo/service/GetClassService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ public class GetClassService {
77

88
/**
99
* 通过类名.class获取, 静态引用, 编译时获取, 适用于知道类名的情况
10-
*
11-
* @return
1210
*/
1311
public static Class<?> getClassByStatic() {
1412
return Object.class;

0 commit comments

Comments
 (0)