inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

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

org.springframework.beans.factory.BeanCreationException 오류

1485

강재은

작성한 질문수 1

0

AOP 적용 목차 전까지는 서버 실행해도 문제 없는데 AOP 적용 예제 넣고 돌리면 아래 에러 코드가 뜨네요..

바로 TimeTraceAop.java 를 넣자마자 BeanCreationException 이 에러가 나오는데 어떻게 해야되죠?

이 에러가 나오는 프로젝트 링크도 같이 올렸습니다..

https://drive.google.com/file/d/1j-eePhGfYIg5oH3p5croYcFI6IhNN4RP/view?usp=sharing

 

에러 코드

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

START :execution(MemberService hello.hellospring.SpringConfig.memberService())

END :execution(MemberService hello.hellospring.SpringConfig.memberService()) 27ms

2022-08-10 20:22:50.081  WARN 16904 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberController' defined in file [C:\Users\36912\Desktop\hello-spring\hello-spring\out\production\classes\hello\hellospring\controller\MemberController.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class hello.hellospring.controller.MemberController: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: No visible constructors in class hello.hellospring.controller.MemberController

2022-08-10 20:22:50.082  INFO 16904 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

2022-08-10 20:22:50.087  INFO 16904 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2022-08-10 20:22:50.109  INFO 16904 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

2022-08-10 20:22:50.111  INFO 16904 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

2022-08-10 20:22:50.127  INFO 16904 --- [           main] ConditionEvaluationReportLoggingListener : 

 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2022-08-10 20:22:50.173 ERROR 16904 --- [           main] o.s.boot.SpringApplication               : Application run failed

 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberController' defined in file [C:\Users\36912\Desktop\hello-spring\hello-spring\out\production\classes\hello\hellospring\controller\MemberController.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class hello.hellospring.controller.MemberController: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: No visible constructors in class hello.hellospring.controller.MemberController

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.20.jar:5.3.20]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.20.jar:5.3.20]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.0.jar:2.7.0]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.0.jar:2.7.0]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.0.jar:2.7.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.0.jar:2.7.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.0.jar:2.7.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.0.jar:2.7.0]

at hello.hellospring.HelloSpringApplication.main(HelloSpringApplication.java:9) ~[classes/:na]

Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class hello.hellospring.controller.MemberController: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: No visible constructors in class hello.hellospring.controller.MemberController

at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:209) ~[spring-aop-5.3.20.jar:5.3.20]

at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[spring-aop-5.3.20.jar:5.3.20]

at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:480) ~[spring-aop-5.3.20.jar:5.3.20]

at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:344) ~[spring-aop-5.3.20.jar:5.3.20]

at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:293) ~[spring-aop-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:455) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1808) ~[spring-beans-5.3.20.jar:5.3.20]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.20.jar:5.3.20]

... 15 common frames omitted

Caused by: java.lang.IllegalArgumentException: No visible constructors in class hello.hellospring.controller.MemberController

at org.springframework.cglib.proxy.Enhancer.filterConstructors(Enhancer.java:763) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:662) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy.generate(ClassLoaderAwareGeneratorStrategy.java:57) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:358) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.3.20.jar:5.3.20]

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]

at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419) ~[spring-core-5.3.20.jar:5.3.20]

at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:57) ~[spring-aop-5.3.20.jar:5.3.20]

at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:206) ~[spring-aop-5.3.20.jar:5.3.20]

... 22 common frames omitted

 

 

종료 코드 1(으)로 완료된 프로세스

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

 

에러 spring-boot aop java spring MVC

답변 1

2

OMG

안녕하세요. 강재은님, 공식 서포터즈 OMG입니다.

Could not generate CGLIB subclass of class hello.hellospring.controller.MemberController: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: No visible constructors in class hello.hellospring.controller.MemberControlle

위 에러 메시지가 문제 해결의 힌트입니다.

 


생성자가 private  접근제어자로 되어 있습니다. public으로 변경해주세요.

private MemberController(MemberService memberService){
this.memberService = memberService;
}

 

감사합니다.

0

Minggul

감사합니다

..

0

80

2

Unused property.....

0

103

2

project JDK is misconfigured

0

136

2

외부 API의 ID 타입(String/UUID)과 내부 도메인의 ID 타입(Long)이 불일치할 때의 설계 정석

0

83

2

단위/통합 테스트 버전충돌 문제

0

91

2

❗️springboot 4.0.2 버전 aspectj dependency 설정❗️

0

231

1

왜 컨트롤러는 변한게 없는데 새로 만든 html 파일이 뜨나요?

0

104

2

윈도우 build test오류 질문

1

103

2

테스트 관련 공부에 대한 조언을 얻고 싶습니다

0

102

2

테스트 실행 시 에러 질문

0

294

1

name을 통한 비교와 객체를 통한 비교

0

77

1

빌드 후 libs 없음

1

131

1

윈도우 gradlew.bat 에러

0

169

1

@PostMapping("/members/new")가 동작하지 않습니다

0

91

1

java static class와 kotlin class

0

79

1

스프링 DB연결

0

127

1

소요 시간

0

87

2

ddl.sql에 빨간 밑줄

1

102

2

welcome page 에러

0

184

3

잘 모르겠습니다.

0

164

2

fail을 똑같이 쳤는데 오류가 발생해요

0

158

2

index.html Welcome page

0

125

1

프로젝트 gradle-groovy ?

0

373

1

테스트코드 메서드명 한글

0

205

2