JAVA/spring

[1028 Spring boot] 에러모음

Error 1

현상 @Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();}

등록시 경로지정을 안해줬다는 에러발생.
찾은것 stackoverflow.com/questions/64822250/illegalstateexception-after-upgrading-web-app-to-spring-boot-2-4
결론 원인은 스프링에서도 component-scan 을 재지정해줌
스프링 부트 그대로 사용하기위해 xml 빈을 안만드려고 다른방법 찾아다니다. 하기 방법발견. 
@Bean
WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> enableDefaultServlet() {
return (factory) -> factory.setRegisterDefaultServlet(true);
}

 

Error 2

현상 Reason: Failed to determine a suitable driver class

패키지 생성후 jdbc 설정안함. 

로그 2024-04-08T16:22:08.264+09:00 ERROR 12468 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter  :


***************************
APPLICATION FAILED TO START
***************************


Description:


Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.


Reason: Failed to determine a suitable driver class




Action:


Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).