diff --git a/springboot.log b/springboot.log index fd424ad..a1fc50f 100644 --- a/springboot.log +++ b/springboot.log @@ -7,25 +7,31 @@ =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.2.0) -2026-03-06T17:09:02.230Z INFO 1154290 --- [springboot-demo] [ main] com.example.demo.DemoApplication : Starting DemoApplication v0.0.1-SNAPSHOT using Java 21.0.10 with PID 1154290 (/home/llm/projects/springboot-demo/target/demo-0.0.1-SNAPSHOT.jar started by llm in /home/llm/projects/springboot-demo) -2026-03-06T17:09:02.380Z INFO 1154290 --- [springboot-demo] [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default" -2026-03-06T17:10:05.868Z INFO 1154290 --- [springboot-demo] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8082 (http) -2026-03-06T17:10:06.093Z INFO 1154290 --- [springboot-demo] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] -2026-03-06T17:10:06.093Z INFO 1154290 --- [springboot-demo] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.16] -2026-03-06T17:10:07.996Z INFO 1154290 --- [springb2026-03-06T17:10:12.808Z INFO 1153691 --- [springboot-demo] [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' -2026-03-06T17:10:14.838Z INFO 1153691 --- [springboot-demo] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat start2026-03-06T17:10:23.314Z INFO 1154290 --- [springboot-demo] [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html] -2026-03-06T17:10:40.414Z INFO 1154290 --- [springboot-demo] [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' -2026-03-06T17:10:41.395Z INFO 1154290 --- [springboot-demo] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8082 (http) with context path '' -2026-03-06T17:10:41.541Z INFO 1154290 --- [springboot-demo] [ main] com.example.demo.DemoApplication : Started DemoApplication in 116.974 seconds (process running for 133.101) +2026-03-07T08:12:47.326Z INFO 1374194 --- [springboot-demo] [ main] com.example.demo.DemoApplication : Starting DemoApplication v0.0.1-SNAPSHOT using Java 21.0.10 with PID 1374194 (/home/llm/projects/springboot-demo/target/demo-0.0.1-SNAPSHOT.jar started by llm in /home/llm/projects/springboot-demo) +2026-03-07T08:12:47.356Z INFO 1374194 --- [springboot-demo] [ main] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default" +2026-03-07T08:13:00.941Z INFO 1374194 --- [springboot-demo] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8082 (http) +2026-03-07T08:13:01.016Z INFO 1374194 --- [springboot-demo] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2026-03-07T08:13:01.020Z INFO 1374194 --- [springboot-demo] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.16] +2026-03-07T08:13:01.808Z INFO 1374194 --- [springboot-demo] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2026-03-07T08:13:01.814Z INFO 1374194 --- [springboot-demo] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 13966 ms +2026-03-07T08:13:07.411Z INFO 1374194 --- [springboot-demo] [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html] +2026-03-07T08:13:15.547Z INFO 1374194 --- [springboot-demo] [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' +2026-03-07T08:13:16.328Z INFO 1374194 --- [springboot-demo] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8082 (http) with context path '' +2026-03-07T08:13:16.450Z INFO 1374194 --- [springboot-demo] [ main] com.example.demo.DemoApplication : Started DemoApplication in 33.141 seconds (process running for 36.573) [EventListener] Spring Boot 应用启动完成! -2026-03-06T17:11:05.601Z INFO 1154290 --- [springboot-demo] [nio-8082-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' -2026-03-06T17:11:05.601Z INFO 1154290 --- [springboot-demo] [nio-8082-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' -2026-03-06T17:11:05.619Z INFO 1154290 --- [springboot-demo] [nio-8082-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 13 ms +2026-03-07T08:13:47.186Z INFO 1374194 --- [springboot-demo] [nio-8082-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2026-03-07T08:13:47.186Z INFO 1374194 --- [springboot-demo] [nio-8082-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2026-03-07T08:13:47.195Z INFO 1374194 --- [springboot-demo] [nio-8082-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms [AOP-Before] Controller 方法开始: root 参数: [] [AOP-AfterReturning] 方法返回: root 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} -[AOP-Performance] LearnController.root() 执行耗时: 18ms +[AOP-Performance] LearnController.root() 执行耗时: 8ms +[AOP-Before] Controller 方法开始: root + 参数: [] +[AOP-AfterReturning] 方法返回: root + 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} +[AOP-Performance] LearnController.root() 执行耗时: 3ms [AOP-Before] Controller 方法开始: root 参数: [] [AOP-AfterReturning] 方法返回: root @@ -35,4 +41,56 @@ 参数: [] [AOP-AfterReturning] 方法返回: root 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} -[AOP-Performance] LearnController.root() 执行耗时: 3ms +[AOP-Performance] LearnController.root() 执行耗时: 10ms +[AOP-Before] Controller 方法开始: getAllUsers + 参数: [] +[AOP-After] Service 方法结束: findAll +[AOP-Performance] UserService.findAll() 执行耗时: 2ms +[AOP-AfterReturning] 方法返回: getAllUsers + 返回值: [com.example.demo.model.User@3616c07a, com.example.demo.model.User@a6b1d0f, com.example.demo.model.User@7935776c] +[AOP-Performance] UserController.getAllUsers() 执行耗时: 5ms +[AOP-Before] Controller 方法开始: info + 参数: [] +[AOP-AfterReturning] 方法返回: info + 返回值: {app=springboot-demo, endpoints=[Ljava.lang.String;@6c7b5bf1, message=欢迎学习 Spring Boot!} +[AOP-Performance] LearnController.info() 执行耗时: 2ms +[AOP-Before] Controller 方法开始: index + 参数: [] +[AOP-AfterReturning] 方法返回: index + 返回值: {endpoints=[Ljava.lang.String;@1b97f799, topics=[Ljava.lang.String;@1fa86033, message=Spring Boot 学习中心} +[AOP-Performance] AopEventController.index() 执行耗时: 11ms +[AOP-Before] Controller 方法开始: root + 参数: [] +[AOP-AfterReturning] 方法返回: root + 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} +[AOP-Performance] LearnController.root() 执行耗时: 6ms +[AOP-Before] Controller 方法开始: index + 参数: [] +[AOP-AfterReturning] 方法返回: index + 返回值: {endpoints=[Ljava.lang.String;@63de5cba, topics=[Ljava.lang.String;@67e1d419, message=Spring Boot 学习中心} +[AOP-Performance] AopEventController.index() 执行耗时: 1ms +[AOP-Before] Controller 方法开始: root + 参数: [] +[AOP-AfterReturning] 方法返回: root + 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} +[AOP-Performance] LearnController.root() 执行耗时: 0ms +[AOP-Before] Controller 方法开始: root + 参数: [] +[AOP-AfterReturning] 方法返回: root + 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} +[AOP-Performance] LearnController.root() 执行耗时: 0ms +[AOP-Before] Controller 方法开始: root + 参数: [] +[AOP-AfterReturning] 方法返回: root + 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} +[AOP-Performance] LearnController.root() 执行耗时: 0ms +[AOP-Before] Controller 方法开始: root + 参数: [] +[AOP-AfterReturning] 方法返回: root + 返回值: {aop=https://spring.xiaoxiaoluohao.indevs.in/aop, learn=https://spring.xiaoxiaoluohao.indevs.in/learn, api=https://spring.xiaoxiaoluohao.indevs.in/api/users, message=欢迎来到 Spring Boot 学习脚手架!} +[AOP-Performance] LearnController.root() 执行耗时: 2ms +[AOP-Before] Controller 方法开始: index + 参数: [] +[AOP-AfterReturning] 方法返回: index + 返回值: {endpoints=[Ljava.lang.String;@22e35681, topics=[Ljava.lang.String;@2214743, message=Spring Boot 学习中心} +[AOP-Performance] AopEventController.index() 执行耗时: 0ms diff --git a/target/classes/application.properties b/target/classes/application.properties index 9206665..619cc0a 100644 --- a/target/classes/application.properties +++ b/target/classes/application.properties @@ -1,2 +1,10 @@ server.port=8082 spring.application.name=springboot-demo + +# 学习友好:默认只保护 /api/secure/** +learning.auth.enabled=true +learning.auth.jwt.secret=demo-learning-secret-key-demo-learning-secret-key +learning.auth.jwt.expiration=86400000 + +# 避免默认生成密码干扰学习输出 +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration diff --git a/target/classes/com/example/demo/common/ApiResponse.class b/target/classes/com/example/demo/common/ApiResponse.class new file mode 100644 index 0000000..b54b3a1 Binary files /dev/null and b/target/classes/com/example/demo/common/ApiResponse.class differ diff --git a/target/classes/com/example/demo/controller/AopEventController.class b/target/classes/com/example/demo/controller/AopEventController.class index 1016611..57ddac5 100644 Binary files a/target/classes/com/example/demo/controller/AopEventController.class and b/target/classes/com/example/demo/controller/AopEventController.class differ diff --git a/target/classes/com/example/demo/controller/LearnController.class b/target/classes/com/example/demo/controller/LearnController.class index 0be2d65..8994ac4 100644 Binary files a/target/classes/com/example/demo/controller/LearnController.class and b/target/classes/com/example/demo/controller/LearnController.class differ diff --git a/target/classes/com/example/demo/controller/UserController.class b/target/classes/com/example/demo/controller/UserController.class index a8bb129..f2794a8 100644 Binary files a/target/classes/com/example/demo/controller/UserController.class and b/target/classes/com/example/demo/controller/UserController.class differ diff --git a/target/classes/com/example/demo/controller/auth/LearningAuthController.class b/target/classes/com/example/demo/controller/auth/LearningAuthController.class new file mode 100644 index 0000000..703dc36 Binary files /dev/null and b/target/classes/com/example/demo/controller/auth/LearningAuthController.class differ diff --git a/target/classes/com/example/demo/controller/auth/SecureDemoController.class b/target/classes/com/example/demo/controller/auth/SecureDemoController.class new file mode 100644 index 0000000..8d4d144 Binary files /dev/null and b/target/classes/com/example/demo/controller/auth/SecureDemoController.class differ diff --git a/target/classes/com/example/demo/dto/UserRequest.class b/target/classes/com/example/demo/dto/UserRequest.class new file mode 100644 index 0000000..26858f5 Binary files /dev/null and b/target/classes/com/example/demo/dto/UserRequest.class differ diff --git a/target/classes/com/example/demo/dto/auth/LoginRequest.class b/target/classes/com/example/demo/dto/auth/LoginRequest.class new file mode 100644 index 0000000..5215006 Binary files /dev/null and b/target/classes/com/example/demo/dto/auth/LoginRequest.class differ diff --git a/target/classes/com/example/demo/exception/GlobalExceptionHandler.class b/target/classes/com/example/demo/exception/GlobalExceptionHandler.class new file mode 100644 index 0000000..f7eaab4 Binary files /dev/null and b/target/classes/com/example/demo/exception/GlobalExceptionHandler.class differ diff --git a/target/classes/com/example/demo/exception/ResourceNotFoundException.class b/target/classes/com/example/demo/exception/ResourceNotFoundException.class new file mode 100644 index 0000000..cd8f79b Binary files /dev/null and b/target/classes/com/example/demo/exception/ResourceNotFoundException.class differ diff --git a/target/classes/com/example/demo/security/LearningJwtFilter.class b/target/classes/com/example/demo/security/LearningJwtFilter.class new file mode 100644 index 0000000..6a8dc46 Binary files /dev/null and b/target/classes/com/example/demo/security/LearningJwtFilter.class differ diff --git a/target/classes/com/example/demo/security/LearningJwtUtil.class b/target/classes/com/example/demo/security/LearningJwtUtil.class new file mode 100644 index 0000000..bfc5299 Binary files /dev/null and b/target/classes/com/example/demo/security/LearningJwtUtil.class differ diff --git a/target/classes/com/example/demo/security/LearningSecurityConfig.class b/target/classes/com/example/demo/security/LearningSecurityConfig.class new file mode 100644 index 0000000..bd64957 Binary files /dev/null and b/target/classes/com/example/demo/security/LearningSecurityConfig.class differ diff --git a/target/classes/com/example/demo/service/UserService.class b/target/classes/com/example/demo/service/UserService.class index fa3f088..186beb2 100644 Binary files a/target/classes/com/example/demo/service/UserService.class and b/target/classes/com/example/demo/service/UserService.class differ diff --git a/target/classes/static/aop.html b/target/classes/static/aop.html index a10416a..89167ea 100644 --- a/target/classes/static/aop.html +++ b/target/classes/static/aop.html @@ -28,6 +28,8 @@ .nav { margin-bottom: 20px; } .nav a { margin-right: 15px; color: #6DB33F; text-decoration: none; } .nav a:hover { text-decoration: underline; } + .lab { background:#fff7e6; border-left:4px solid #fa8c16; padding:15px; border-radius:8px; margin:15px 0; } + .lab h4 { color:#ad6800; margin-bottom:8px; }
@@ -38,11 +40,24 @@/api/usersAOP 自动统计所有 Controller 和 Service 方法的执行时间
+