[SPRING] SpelEvaluationException 메서드를 찾을 수 없습니다.
SPRINGSpelEvaluationException 메서드를 찾을 수 없습니다.
나는 SpEL을 사용하여 서비스 메소드에 사용자를 전달하려고 할 때 다음 문제에 직면하고있다.
evaluate expression="commonService.userTest(user)" result="flowScope.user"
봄은 다음 예외를 throw합니다.
그러나 User 객체 대신 일반 텍스트를 전달할 때,
evaluate expression="commonService.userTest('Hello')" result="flowScope.user"
오류가 없습니다.
@Entity
@Table(name = "users")
@Getter
@Setter
@NoArgsConstructor
@Slf4j
public class User extends BaseEntity implements UserDetails {
@Column(unique = true)
@NotEmpty
private String username;
@Column
@NotEmpty
@Size(min = 5)
private String password;
}
@Service("commonService")
public class CommonServiceImpl implements CommonService {
@Transactional(readOnly = true)
@Override
public User userTest(String name) {
User user = createUser();
user.setUsername(name);
return user;
}
@Transactional(readOnly = true)
@Override
public User userTest(User user) {
return user;
}
}
해결법
-
==============================
1.업데이트 # 2 - 해결 방법
업데이트 # 2 - 해결 방법
DevTools 의존성을 제거해도 문제는 해결되었지만이 솔루션을 적용하면 Spring Boot Dev Tools 및 Web Flow는 훌륭하게 작동하지 않지만 src / main / resources / META-INF / 아래에 spring-devtools.properties를 작성하면 다음 줄과 함께 no 전혀 문제가 없다.
restart.include.spring=/.*\.jar
왜 내가 링크에서 언급 한 것처럼이 라인을하지 않았 :
restart.include.spring=/spring-.*\.jar
이 예외가있어서
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webFlowConfig': Unsatisfied dependency expressed through field 'webMvcConfig'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcConfig': Unsatisfied dependency expressed through field 'springTemplateEngine'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultTemplateResolver' defined in class path resource [org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver]: Factory method 'defaultTemplateResolver' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, org/springframework/boot/autoconfigure/thymeleaf/AbstractTemplateResolverConfiguration, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/thymeleaf/spring4/templateresolver/SpringResourceTemplateResolver, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at medicallab.MedicallabApplication.main(MedicallabApplication.java:10) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.6.RELEASE.jar:1.5.6.RELEASE] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcConfig': Unsatisfied dependency expressed through field 'springTemplateEngine'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultTemplateResolver' defined in class path resource [org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver]: Factory method 'defaultTemplateResolver' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, org/springframework/boot/autoconfigure/thymeleaf/AbstractTemplateResolverConfiguration, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/thymeleaf/spring4/templateresolver/SpringResourceTemplateResolver, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] ... 24 common frames omitted Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultTemplateResolver' defined in class path resource [org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver]: Factory method 'defaultTemplateResolver' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, org/springframework/boot/autoconfigure/thymeleaf/AbstractTemplateResolverConfiguration, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/thymeleaf/spring4/templateresolver/SpringResourceTemplateResolver, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] ... 37 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultTemplateResolver' defined in class path resource [org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver]: Factory method 'defaultTemplateResolver' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, org/springframework/boot/autoconfigure/thymeleaf/AbstractTemplateResolverConfiguration, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/thymeleaf/spring4/templateresolver/SpringResourceTemplateResolver, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1180) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] ... 59 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver]: Factory method 'defaultTemplateResolver' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, org/springframework/boot/autoconfigure/thymeleaf/AbstractTemplateResolverConfiguration, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/thymeleaf/spring4/templateresolver/SpringResourceTemplateResolver, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE] ... 75 common frames omitted Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, org/springframework/boot/autoconfigure/thymeleaf/AbstractTemplateResolverConfiguration, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/thymeleaf/spring4/templateresolver/SpringResourceTemplateResolver, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature at org.springframework.boot.autoconfigure.thymeleaf.AbstractTemplateResolverConfiguration.defaultTemplateResolver(AbstractTemplateResolverConfiguration.java:70) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration.defaultTemplateResolver(ThymeleafAutoConfiguration.java:140) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration$$EnhancerBySpringCGLIB$$f2a7a126.CGLIB$defaultTemplateResolver$0(<generated>) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration$$EnhancerBySpringCGLIB$$f2a7a126$$FastClassBySpringCGLIB$$7a53489b.invoke(<generated>) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration$$EnhancerBySpringCGLIB$$f2a7a126.defaultTemplateResolver(<generated>) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEA SE] ... 76 common frames omitted
그래서 지금은 모든 항아리를 포함시켜야합니다. 향후에 누군가에게 도움이되기를 희망하지만, Update # 1을 참조하십시오. 이는 Spring DevTools 클래스 로더 제한 사항에서 해결 될 수 있지만 LiveReload 서버로 이어지는 것은 실행되지 않기 때문입니다.
업데이트 # 1
이것은 DevTools 문제 (재시작 클래스 로더 사용자 정의)가 곧 스프링 DevTools 클래스 로더 제한으로 수정 될 수있는 것처럼 보입니다. 이번 호에서 시작됩니다. Spring Boot Dev Tools 및 Web Flow는 훌륭하게 작동하지 않습니다.
원문 답변
나는 여러 번 같은 문제를 겪었고, 나는 시험을 마쳤고, 나는 이상한 행동을 발견했다.
public class SomeModel implements Serializable { private static final long serialVersionUID = -7967970066125990593L; ... }
CustomFlowAction.java
package app.flow; public class CustomFlowAction { // Note here the paramter is of type Object, just to use casting instead of using the object directly to test if I have the correct one public boolean someAction(Object obj, RequestContext context) { SomeModel someModel = (SomeModel) obj; return true } public SomeModel prepareSomeModel() { return new SomeModel(); } }
(플로우 예 1) some-flow.xml
이 예제는 스프링 빈을 사용하고 있으며, 잘 작동하고 someAction 메소드는 true를 리턴한다.
<flow ...> <view-state id="StateOne" model="someModel"> <transition on="next" to="StateTwo"> <evaluate expression="customFlowAction.someAction(someModel, flowRequestContext)"></evaluate> </transition> </view-state> </flow>
(플로우 예 2) some-flow.xml
이 예제는 SomeModel에서 새로운 객체를 생성하고 flowScope를 저장 한 다음 템플릿 내부에서 사용합니다.
<flow ...> <on-start> <evaluate expression="submitRequestFlowAction.prepareSomeModel()" result="flowScope.someModel"></evaluate> </on-start> <view-state id="StateOne" model="someModel"> <transition on="next" to="StateTwo"> <evaluate expression="customFlowAction.someAction(someModel, flowRequestContext)"></evaluate> </transition> </view-state> </flow>
출력은 다음과 같습니다.
java.lang.ClassCastException: app.flow.SomeModel cannot be cast to app.flow.SomeModel
어떤 사람들은 저에게 문제에 관여하는 또 다른 클래스 로더가있을지도 모른다고 안내했고,
희망이 당신과 나를 위해 곤경에 다른 사람을 위해 도움이 될 것입니다 :)
-
==============================
2.이 오류는 데이터베이스에서 개체를 가져 오는 것과 관련이 있습니다. 이 문제를 해결하기 위해 트랜잭션이있는 프록시 객체를 호출하고 해결 한 서비스 클래스를 만들었습니다.
이 오류는 데이터베이스에서 개체를 가져 오는 것과 관련이 있습니다. 이 문제를 해결하기 위해 트랜잭션이있는 프록시 객체를 호출하고 해결 한 서비스 클래스를 만들었습니다.
@Transactional(readOnly = true) public User findOneByCustomerPersonalEmail(String email) { User user = userRepository.findOneByCustomerPersonalEmail(email); user.getCustomer(); //this line fills the proxied object return user; }
from https://stackoverflow.com/questions/40300407/spelevaluationexception-method-cannot-be-found by cc-by-sa and MIT license
'SPRING' 카테고리의 다른 글
[SPRING] CommandLineRunner 실행 실패 - 스프링 배치 (0) | 2019.05.01 |
---|---|
[SPRING] 값을 집계하고 단일 값을 쓰는 스프링 배치 (0) | 2019.05.01 |
[SPRING] javax.faces.el.VariableResolver SpringBeanFacesELResolver를 사용하는 클래스 캐스트 예외 (0) | 2019.05.01 |
[SPRING] 스프링 배치를 구성하여 메타 데이터를 저장하기위한 배치 테이블을 자동으로 생성하지 않으려면 어떻게해야합니까? (0) | 2019.05.01 |
[SPRING] PostConstruct가 두 번 호출됩니다. (0) | 2019.05.01 |