inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

토비의 스프링 부트 - 이해와 원리

@Conditional과 Condition

안녕하세요 강사님 JettyWebServerFactory Bean생성 하는데서 오류가납니다

해결된 질문

694

김성민

작성한 질문수 15

0

 org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jettyWebServerFactory' defined in class path resource [tobyspring/config/autoconfig/JettyWebServerConfig.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2437c6dc]

 

이런에러가나구요

 

package tobyspring.config.autoconfig;

import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.type.AnnotatedTypeMetadata;
import tobyspring.config.MyAutoConfiguration;

@MyAutoConfiguration
@Conditional(JettyWebServerConfig.JettyCondition.class)
public class JettyWebServerConfig {
@Bean("jettyWebServerFactory")
public ServletWebServerFactory servletWebServerFactory(){
return new JettyServletWebServerFactory();
}

static class JettyCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
return true;
}
}
}

 

이건 코드입니다 왜 오류가날까요 틀린게없는거같습니다

spring spring-boot spring-jdbc

답변 1

1

토비

에러 메시지로 봐서는 Jetty 클래스를 찾지 못하는 것 같습니다. 아마 에러의 뒷 부분이 더 있을 것 같은데요.

Gradle에 Jetty 라이브러리 추가한 뒤에 설정을 IDE 프로제트로 로딩하는 것까지 하셨는지 확인해보세요.

그래도 계속 안 된다면 지금 에러가 나는 프로젝트를 GitHub 등을 통해서 공유해주시면 제가 받아서 확인해보겠습니다.

1

김성민

뭔가 jetty 라이브러리 추가하고나서 프로젝트에적용되는데까지 굉장히 많은시간이 걸린거같습니다 해결되었습니다 감사합니다!

11강에서 cmd에서 spring shell에 $ init 하면 Fail 메세지

0

75

2

TestRestTemplate 을 통해 테스트 실행시 웹 요청 정보가 콘솔에 표시되지 않습니다.

0

85

1

섹션7. 자동구성 정보파일분리 강의 질문(@MyAutoConfiguration 붙힌 이유)

0

201

2

WebApplicationContext를 DispatcherServlet에 this로 넘기는 것

0

279

2

인프라 빈 구성 정보의 분리에서 EnableMyAutoConfiguration 질문드립니다.

0

210

2

질문드립니다.

0

232

2

spring boot 3.3.7로 학습중입니다.

0

369

2

Serverproperties 객체 생성 후 @Impor 어노테이션 사용 이유 용도

0

162

2

spring start io 에서 이제더이상 2.x버전은 지원하지 않는 것 같습니다.

1

296

2

Springboot 3.2 이상에서 파라미터 추론관련

0

913

4

binding error

0

220

3

Arrays.copyOf 메서드의 타입 세이프

1

155

2

MyOnClassCondition에 있는 matches method의 Invoke 횟수

1

233

3

인용구의 출처가 궁금합니다.

0

259

1

프로퍼티 빈의 후처리기 도입 AnnotationUtils의 사용

0

236

2

SimpleCacheConfiguration과 빈 등록

0

168

2

MyAutoConfigImportSelector 에서 생성자로 ClassLoader를 주입받을 수 있는 점

0

244

1

IntelliJ project jenerator spring initailizr

0

150

1

강의 자료 레퍼지토리에 업로드

0

216

1

강의자료

0

388

1

Hikari 라이브러리가 없으면 오류가 나는거 아닌가요

0

314

2

Tomcat 포트 프로퍼티 미설정시 랜덤 포트 설정 문의

0

476

5

@Import 로 Bean을 등록해야하는 기준이 뭔지 궁금합니다.

0

340

2

application.properties파일내 프로퍼티 이름

0

210

1