인프런 커뮤니티 질문&답변

수푸링님의 프로필 이미지
수푸링

작성한 질문수

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

AOP 적용

AOP 시간 출력

작성

·

274

1

2022-08-03 16:59:23.367  INFO 16631 --- [           main] b.basicspring.BasicSpringApplication     : Starting BasicSpringApplication using Java 11.0.16 on yundabinui-MacBookPro.local with PID 16631 (/Users/yundabin/Spring/basic-spring/out/production/classes started by yundabin in /Users/yundabin/Spring/basic-spring)
2022-08-03 16:59:23.371  INFO 16631 --- [           main] b.basicspring.BasicSpringApplication     : No active profile set, falling back to 1 default profile: "default"
2022-08-03 16:59:23.993  INFO 16631 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-08-03 16:59:24.040  INFO 16631 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 38 ms. Found 1 JPA repository interfaces.
2022-08-03 16:59:24.529  INFO 16631 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-08-03 16:59:24.541  INFO 16631 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-08-03 16:59:24.541  INFO 16631 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-08-03 16:59:24.639  INFO 16631 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-08-03 16:59:24.639  INFO 16631 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1205 ms
2022-08-03 16:59:24.805  INFO 16631 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-08-03 16:59:24.848  INFO 16631 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.10.Final
2022-08-03 16:59:25.002  INFO 16631 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-08-03 16:59:25.093  INFO 16631 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-08-03 16:59:25.176  INFO 16631 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-08-03 16:59:25.205  INFO 16631 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2022-08-03 16:59:25.673  INFO 16631 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-08-03 16:59:25.682  INFO 16631 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-08-03 16:59:26.077  WARN 16631 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-08-03 16:59:26.219  INFO 16631 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: class path resource [static/index.html]
2022-08-03 16:59:26.418  INFO 16631 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2022-08-03 16:59:26.427  INFO 16631 --- [           main] b.basicspring.BasicSpringApplication     : Started BasicSpringApplication in 3.44 seconds (JVM running for 3.815)
2022-08-03 16:59:30.990  INFO 16631 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-08-03 16:59:30.991  INFO 16631 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-08-03 16:59:30.992  INFO 16631 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
Hibernate: select member0_.id as id1_0_, member0_.name as name2_0_ from member member0_ where member0_.name=?
Hibernate: insert into member (id, name) values (default, ?)
Hibernate: select member0_.id as id1_0_, member0_.name as name2_0_ from member member0_
Hibernate: select member0_.id as id1_0_, member0_.name as name2_0_ from member member0_

-------------------------------------------------------------

으로 시간 결과가 출력이 안되는데 혹시 이유가 무엇일까요?

제 파일이 hello.hellospring이 아니라

basic.basicspring이라서 

@Around("execution(* basic.basicspring..*(..))") 으로 적어두었는데 이것 때문일까요..?

답변 1

1

안녕하세요. 수푸링님, 공식 서포터즈 David입니다.

1. AOP 클래스가 @Component가 적용되었는지

2. AOP 적용 대상인 메서드가 호출되었는지

3. Around에 작성한 경로가 패키지와 일치하는지

위 3가지 사항을 확인해주세요.

감사합니다.

수푸링님의 프로필 이미지
수푸링

작성한 질문수

질문하기