Created
October 3, 2016 17:26
-
-
Save lynas/af77b51ff4ff51b9b662399b91ebd373 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lynas.config | |
import com.github.mxab.thymeleaf.extras.dataattribute.dialect.DataAttributeDialect | |
import nz.net.ultraq.thymeleaf.LayoutDialect | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.context.annotation.Bean | |
import org.springframework.context.annotation.ComponentScan | |
import org.springframework.context.annotation.Configuration | |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer | |
import org.springframework.web.servlet.config.annotation.* | |
import org.thymeleaf.dialect.IDialect | |
import org.thymeleaf.spring4.SpringTemplateEngine | |
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver | |
import org.thymeleaf.spring4.view.ThymeleafViewResolver | |
import org.thymeleaf.templatemode.TemplateMode | |
import java.util.* | |
@Configuration | |
@EnableWebMvc | |
@ComponentScan("com.lynas") | |
open class WebConfig() : WebMvcConfigurerAdapter() { | |
@Autowired | |
lateinit var interceptorConfig: InterceptorConfig | |
@Bean | |
open fun templateResolver(): SpringResourceTemplateResolver { | |
val resolver = SpringResourceTemplateResolver().apply { | |
isCacheable = false | |
templateMode = TemplateMode.HTML | |
prefix = "/" | |
suffix = ".html" | |
} | |
return resolver | |
} | |
@Bean | |
open fun templateEngine(): SpringTemplateEngine { | |
return SpringTemplateEngine().apply { | |
setTemplateResolver(templateResolver()) | |
setAdditionalDialects(HashSet<IDialect>().apply { | |
add(LayoutDialect()) | |
}) | |
addDialect(DataAttributeDialect()) | |
} | |
} | |
@Bean | |
open fun viewResolver() = ThymeleafViewResolver().apply { | |
templateEngine = templateEngine() | |
order = 1 | |
viewNames = arrayOf("*", "js/*", "template/*") | |
} | |
@Bean | |
open fun properties() = PropertySourcesPlaceholderConfigurer().apply { | |
setIgnoreResourceNotFound(true) | |
setIgnoreUnresolvablePlaceholders(false) | |
} | |
override fun configureDefaultServletHandling(configurer: DefaultServletHandlerConfigurer) { | |
configurer.enable() | |
} | |
override fun addInterceptors(registry: InterceptorRegistry) { | |
registry.addInterceptor(interceptorConfig) | |
} | |
override fun addResourceHandlers(registry: ResourceHandlerRegistry) { | |
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/") | |
} | |
} | |
[RMI TCP Connection(3)-127.0.0.1] INFO org.springframework.data.neo4j.config.Neo4jConfiguration - Initialising Neo4jTransactionManager | |
[RMI TCP Connection(3)-127.0.0.1] INFO org.springframework.security.web.DefaultSecurityFilterChain - Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@7cac08ee, org.springframework.security.web.context.SecurityContextPersistenceFilter@63e69e97, org.springframework.security.web.header.HeaderWriterFilter@7bd67ab4, org.springframework.security.web.csrf.CsrfFilter@173c7dd6, org.springframework.security.web.authentication.logout.LogoutFilter@3aa55b6c, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@41907aac, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@55215b90, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@312ef92f, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@60172063, org.springframework.security.web.session.SessionManagementFilter@36bca815, org.springframework.security.web.access.ExceptionTranslationFilter@a962380, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@12251afd] | |
03-Oct-2016 23:25:12.136 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:\devTools\apache-tomcat-8.0.36\webapps\manager | |
[RMI TCP Connection(3)-127.0.0.1] WARN org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is kotlin.UninitializedPropertyAccessException: lateinit property interceptorConfig has not been initialized | |
[RMI TCP Connection(3)-127.0.0.1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed | |
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is kotlin.UninitializedPropertyAccessException: lateinit property interceptorConfig has not been initialized | |
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) | |
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) | |
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) | |
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) | |
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) | |
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) | |
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) | |
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) | |
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) | |
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) | |
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) | |
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4840) | |
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) | |
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) | |
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) | |
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) | |
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) | |
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) | |
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) | |
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) | |
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484) | |
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) | |
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) | |
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) | |
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) | |
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) | |
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) | |
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) | |
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324) | |
at sun.rmi.transport.Transport$1.run(Transport.java:200) | |
at sun.rmi.transport.Transport$1.run(Transport.java:197) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at sun.rmi.transport.Transport.serviceCall(Transport.java:196) | |
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) | |
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) | |
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) | |
at java.lang.Thread.run(Thread.java:745) | |
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is kotlin.UninitializedPropertyAccessException: lateinit property interceptorConfig has not been initialized | |
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) | |
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) | |
... 59 more | |
Caused by: kotlin.UninitializedPropertyAccessException: lateinit property interceptorConfig has not been initialized | |
at com.lynas.config.WebConfig.addInterceptors(WebConfig.kt:69) | |
at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.addInterceptors(WebMvcConfigurerComposite.java:119) | |
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.addInterceptors(DelegatingWebMvcConfiguration.java:57) | |
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.getInterceptors(WebMvcConfigurationSupport.java:284) | |
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerMapping(WebMvcConfigurationSupport.java:244) | |
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$d83dcbcb.CGLIB$requestMappingHandlerMapping$19(<generated>) | |
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$d83dcbcb$$FastClassBySpringCGLIB$$29756e0b.invoke(<generated>) | |
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) | |
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) | |
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$d83dcbcb.requestMappingHandlerMapping(<generated>) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) | |
... 60 more | |
03-Oct-2016 23:25:12.171 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file | |
03-Oct-2016 23:25:12.172 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors | |
[2016-10-03 11:25:12,201] Artifact EOMS:war exploded: Error during artifact deployment. See server log for details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment