spring mvc如何给controller 配置指定的interceptor

例如系统中有些controller需要验证是否登录,有些需要验证是否有权限访问,而其他的controller是不需要进行任何验证就可以访问的,这种情况该怎么配置interceptor?










这种方式会让所有配置@Controller的访问都进入这两个拦截器,有没有什么方法能灵活的基于注解的方式指定要不要进入拦截器?

4个回答

你可以在Controller里面加上字段 private boolean needVerifyLogin;
然后在对应的拦截器里面判断是否有这个字段 例如:
[code="java"]
public class LoginRequiredInterceptorextends HandlerInterceptorAdapter {

@Override
public boolean preHandle(HttpServletRequest request,
        HttpServletResponse response, Object handler) throws Exception {

    Class clazz = handler.getClass();
    Field field = clazz.getDeclaredField("needVerifyLogin");
    if (field != null) {
        field.setAccessible(true);
        if (field.getBoolean(handler)) {
            if (request.getSession(false) == null) {
                // 没有登录
                                    return false;
            }
        }
    }

    return super.preHandle(request, response, handler);
}

}

[/code]

你也可以按zouruixin 说的写个注解, 比如
[code="java"]
@Target(ElementType.TYPE)
public @interface Intercept {

String[] value() default {};

}

Controller里面这样用:
@Controller
@RequestMapping("/email_account.do")
@Intercept({"com.ykxd.web.system.SystemFrontIntercepter"}) // 可以配多个
public class EmailAccountController {
[/code]

然后重写DispatcherServlet的doDispatch
在这边判断:
[code="java"]
HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
if (interceptors != null) {
for (int i = 0; i < interceptors.length; i++) {
HandlerInterceptor interceptor = interceptors[i];
if (!interceptor.preHandle(processedRequest, response, mappedHandler.getHandler())) {
triggerAfterCompletion(mappedHandler, interceptorIndex, processedRequest, response, null);
return;
}
interceptorIndex = i;
}
}
[/code]
具体配了哪个就拦截哪个

重新默认的annotation, 加入自己的需求就可以了

可以自己写一个注解的解析组件来实现,我们的工程目前采用这种方案,就是@NeedLogin
class XXX extends controller

然后写一个filter类,实现BeanFactoryPostProcessor

取得BeanFactory后,遍历所管理的bean,如果该bean实现了@NeedLogin
则判断是否登录

还有一种方式,就是独立配置一个xml,不需要加入interceptors拦截器配置,在总的配置文件中引入这个配置文件就行了,这样就可以达到动态配置的效果,比较方便简单,不需要写什么解析引擎。。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring mvc中如何实现对指定controller拦截

比如,现在有两个controller:A,B,一个拦截器,如何实现只拦截A,或者只拦截B? 初学spring MVC,望资深人士说的详细些,谢谢!

spring mvc图片上传,怎么在Controller中接收?不用上传的,只用接收?

![图片说明](https://img-ask.csdn.net/upload/201608/01/1470036237_371438.png) 就在红色框框里接收,或者在这个方法里接收,就好了,后面有个方法给接口就行了,求大神!在线等 大神写好的接口,我只用上传就好了 配置如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd "> <!-- 自动扫描且只扫描@Controller --> <context:component-scan base-package="com.wadata.hspjkpt.v1.xt.web.controller"/> <mvc:annotation-driven> <mvc:argument-resolvers> <bean class="com.wadata.hspjkpt.v1.interceptor.CommonHandlerMethodArgumentResolver" /> </mvc:argument-resolvers> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/plain;charset=UTF-8</value> <value>application/javascript;charset=UTF-8</value> <value>text/css;charset=UTF-8</value> </list> </property> </bean> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> <property name="supportedMediaTypes"> <value>text/plain;charset=UTF-8</value> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <!-- 容器默认的DefaultServletHandler处理 所有静态内容与无RequestMapping处理的URL --> <mvc:default-servlet-handler/> <!-- 定义无需Controller的url<->view直接映射 --> <mvc:view-controller path="/xzzx*" view-name="redirect:/" /> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="defaultEncoding"> <value>UTF-8</value> </property> <property name="maxUploadSize"> <value>1073741824</value> </property> </bean> </beans>

线程安全spring mvc controller java.io.IOException: Stream closed异常

程序的流程是客户端发送一个Http post请求请求的内容是一个xml文件,服务器通过spring mvc 的controller接收 然后response 返回xml @Controller public class QueryController { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { //业务处理..... } } 类似上面的调用,间隔时间比较短的情况下会出现下面的异常,分析原因是Spring MVC的controller不是线程安全的,每次请求都是同一个servlet,当第一次请求的reponse或request关闭后,接下来的请求就会出现stream closed的情况。 尝试了几种方式: 1.用ThreadLocal管理request response 问题依然存在 2.尝试把处理写成无状态,线程安全的视乎很难 3.SingleThreadModel ,synchronized 管理好像也不行,感觉无法控制response和request对象。 现在的想法是把这个servlet变成线程安全,尝试了下视乎配置的不对,希望大家指点。 还有就是像这样的业务比较好的解决方法是什么,也请大家分享一下。 java.io.IOException: Stream closed at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:406) at org.apache.catalina.connector.CoyoteReader.read(CoyoteReader.java:105) at org.apache.xmlbeans.impl.piccolo.xml.XMLReaderReader.fillCharBuffer(XMLReaderReader.java:247) at org.apache.xmlbeans.impl.piccolo.xml.XMLReaderReader.reset(XMLReaderReader.java:84) at org.apache.xmlbeans.impl.piccolo.xml.DocumentEntity.open(DocumentEntity.java:74) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.reset(PiccoloLexer.java:982) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:709) at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1329) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1316) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:360) at org.poc.pos.obervationQuery.QueryObservationRequestDocument$Factory.parse(Unknown Source) at com.yuxin.referral.services.ObservationQueryServiceImpl.ObservationQueryRequest(ObservationQueryServiceImpl.java:79) at com.yuxin.referral.services.ObservationQueryServiceImpl$$FastClassByCGLIB$$27758ac0.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625) at com.yuxin.referral.services.ObservationQueryServiceImpl$$EnhancerByCGLIB$$e00082b7.ObservationQueryRequest(<generated>) at com.yuxin.referral.web.ObservationQueryController.handleRequest(ObservationQueryController.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at com.springsource.metrics.collection.web.HttpRequestMetricCollectionValve.invoke(HttpRequestMetricCollectionValve.java:44) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:379) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619)

spring MVC 的拦截器怎么拦截不了

我想用spring mvc实现登录拦截: 配置文件:<mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/users/*" /> <bean class="com.yj.send.interceptor.UsersCheckLoginInterceptor" /> </mvc:interceptor> <mvc:interceptor> <mvc:mapping path="/senders/*" /> <bean class="com.yj.send.interceptor.SendersCheckLoginInterceptor" /> </mvc:interceptor> 因为是spring3.0不支持 <mvc:exclude-mapping >标签,所以我在perHandle的方法来排除不需要的拦截的url。 问题如下: 在controller里@Controller @RequestMapping("users/orglogin") public class SenderOrgLoginController { ...... } 在perHandle()方法里System.out.pirntln("----------------"); 然后用户登录后,始终不执行perHandle的方法(拦截器失效)。 但是在: @Controller @RequestMapping("/senders") public class SenderLoginController { ...... } 在该拦截器的实现类里的perHandle方法里面,我也输出一条语句,登陆后,却执行了。然后我将 @RequestMapping("users/orglogin")改成@RequestMapping("users")就行了。 上网百度了半天,都没有原因(拦截器拦截的url怎么与controller有关,应该跟resquest的url有关么?) 求大神指教!非常感谢。

Spring MVC 缓存问题

<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>首先说一下,静态资源的缓存没有问题,该问题是关于动态内容的缓存,需求是获取各国家列表,因为国家列表内容相对稳定些,所以想利用缓存节省不必要的开销。</p> <p> </p> <p>代码如下:</p> <ul> <li> <span style="font-size: 12px; line-height: 1.5;"><span style="font-size: 12px; line-height: 1.5;">用于获取各国家列表的 Controller:<br></span></span> <pre name="code" class="java">@Controller @RequestMapping("/country") public class CountryController{ @Autowired private CountryService countryService; @RequestMapping(method=RequestMethod.GET) public ModelAndView show(){ ModelAndView mav = new ModelAndView(); mav.addObject("countryMap", countryService.getCountries()); mav.setViewName("test"); return mav; } }</pre> </li> <li> <span style="font-size: 12px; line-height: 1.5;">缓存拦截器配置</span><br><pre name="code" class="xml"><span style="font-size: 12px; line-height: 1.5;"><span style="font-size: 12px; line-height: 1.5;">&lt;mvc:interceptor&gt; &lt;mvc:mapping path="/country*" /&gt; &lt;bean class="org.springframework.web.servlet.mvc.WebContentInterceptor" &gt; &lt;property name="cacheMappings"&gt; &lt;map&gt; &lt;entry key="/country.json" value="31536000"&gt;&lt;/entry&gt; &lt;entry key="/country" value="31536000"&gt;&lt;/entry&gt; &lt;/map&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/mvc:interceptor&gt;</span></span></pre> </li> </ul> <p><span style="font-size: 12px; line-height: 1.5;"><span style="font-size: 12px; line-height: 1.5;">当请求 http://host:port/app/country 时,请求头信息和响应头信息如下:</span></span></p> <p> </p> <pre name="code" class="xml"><span style="font-size: 12px; line-height: 1.5;"><strong>Request</strong></span> Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip,deflate,sdch Accept-Language:zh-CN,zh;q=0.8 Cache-Control:max-age=0 Connection:keep-alive Cookie:JSESSIONID=FE1D5C67B795BEBB40C2A72367170A52 Host:localhost:8080 User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36</pre> <p> </p> <p> </p> <p> </p> <pre name="code" class="xml"><span style="font-size: 12px; line-height: 1.5;"><strong>Response</strong></span> <span style="font-size: 12px; line-height: 1.5;"><strong>Cache-Control:max-age=31536000</strong></span> Content-Language:zh-CN Content-Length:4033 Content-Type:text/html;charset=UTF-8 Date:Sun, 23 Mar 2014 11:25:19 GMT <strong><span style="font-size: 12px; line-height: 1.5;">Expires:Mon, 23 Mar 2015 11:25:19 GMT</span></strong> Server:Apache-Coyote/1.1</pre> <p><span style="font-size: 12px; line-height: 1.5;"><span style="font-size: 12px; line-height: 1.5;"> </span></span></p> <p><span style="font-size: 12px; line-height: 1.5;"><span style="font-size: 12px; line-height: 1.5;">响应头信息中的 Cache-Control 和 Expires 都正确,多次刷新页面,通过浏览器调试工具查看,并没有从缓存中获取内容,希望懂的朋友帮忙找找原因。</span></span></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div>

Spring5.0+Spring MVC+ Hibernate 整合

24-Mar-2018 21:24:36.132 警告 [RMI TCP Connection(3)-127.0.0.1] org.springframework.context.support.AbstractApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException 24-Mar-2018 21:24:36.133 严重 [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.servlet.FrameworkServlet.initServletBean Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1231) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1130) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:676) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:642) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:690) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:558) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:499) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:172) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4903) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809) at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809) at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466) at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:75) at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307) at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399) at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:800) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:682) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.base/java.lang.Thread.run(Thread.java:844) Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:175) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:88) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1223) ... 65 more Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:67) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.<init>(RequestMappingHandlerAdapter.java:190) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ... 67 more Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109) ... 74 more

spring mvc4 动态切换语言不起作用

我利用 SPRING4 MVC配置了动态切换语言,但是在页上点击中文、英文切换的时候不起作用。请高手看看 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <!-- <mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes" value="text/plain;charset=UTF-8"/> </bean> </mvc:message-converters> </mvc:annotation-driven> --> <!-- 启用Spring MVC注解功能 --> <mvc:annotation-driven/> <!-- 启动Srping组件自动扫描机制,Spring会自动扫描base-package包及其子包下面的类 --> <context:component-scan base-package="com.efs.business"/> <!-- 设置视图解析类,使用默认的JSTL解析器 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp"/> <property name="suffix" value=".jsp"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> </bean> <!-- 系统配置拦截器 --> <mvc:interceptors> <!-- 切换语言拦截器 --> <mvc:interceptor> <mvc:mapping path="/*"/> <ref bean="localeChangeInterceptor"/> </mvc:interceptor> </mvc:interceptors> <!-- 配置国际化资源文件,包括动态切换 START --> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename" value="com.efs.resource.Message"/> </bean> <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"> </bean> <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"> <property name="paramName" value="locale"/> </bean> <!-- 配置国际化资源文件,包括动态切换 END --> </beans> Controller: package com.efs.business.locale; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.LocaleResolver; @Controller @RequestMapping("/locale") public class SysLocaleController { @Autowired private LocaleResolver localeResolver; @RequestMapping("/changeLocale") public String changeLocale(String locale,HttpServletRequest request,HttpServletResponse response) { Locale l = new Locale(locale); localeResolver.setLocale(request, response, l); return "redirect:/demo/index.do"; } } 页面: <a href="<%=basePath%>/locale/changeLocale.do?locale=zh_CN">中文</a> | <a href="<%=basePath%>/locale/changeLocale.do?locale=en_US">English</a> <hr/> <form action="<%=basePath%>/demo/login.do" method="post" id="form"> <!-- 页面上使用资源国际化 --> <sf:message code="demo.label.userName" />:<input type="text" name="userName" value="${form.userName }" /> <br/> <sf:message code="demo.label.password" />:<input type="password" name="password" /><br/>

spring mvc 不同权限,拦截器问题

我有一个controller里面有几个函数,有的只允许学生调用,有的只允许管理员调用,有什么办法根据自己的需要使用不同的拦截器呢? 比如book/addbook只允许管理员调用,而book/findbookbyname又允许登陆的人都可以调用,

Spring mvc做登录拦截,诡异的报404,tomcat日志没有任何输出

先看出错提示![图片说明](https://img-ask.csdn.net/upload/201506/17/1434534385_621647.png) TOMCAT没有日志输出,直接在浏览器报的404 拦截器类方法: public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { LoginAccount user=(LoginAccount) request.getSession().getAttribute("user"); String url=request.getRequestURL().toString(); System.out.println("进入拦截器,请求地址:"+url); if(user==null){ response.sendRedirect("index.jsp"); return false; }else{ return true; } } ``` 拦截器配置 <mvc:view-controller path="/" view-name="index"/> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <mvc:mapping path="/"/> <mvc:exclude-mapping path="/login.do"/> <mvc:exclude-mapping path="/logout.do"/> <mvc:exclude-mapping path="/room.do"/> <bean id="loginInterceptor" class="com.jszy.oa.intercepter.LoginInterceptor"> <property name="loginUrl" value="login.do"></property> </bean> </mvc:interceptor> </mvc:interceptors> ``` WEB.XML 配置,<url-pattern>节点参考http://iammr.7.blog.163.com/blog/static/49102699201222643458216/文章,拦截根目录。在用户SESSION未超时访问根目录时跳转到后台首页 <servlet> <servlet-name>spring-mvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <description>spring MVC 配置文件</description> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-mvc-websocket.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring-mvc</servlet-name> <url-pattern></url-pattern> </servlet-mapping> ``` ``` 出问题的地方就在访问http://localhost:8080/oa/,点击登录时请求http://localhost:8080/oa/login.do报了404,没有输出日志。 如果把<url-pattern></url-pattern>改成<url-pattern>*.do</url-pattern> 拦截器能正常工作,就是没有办法拦截这个地址http://localhost:8080/oa/

spring mvc 为什么不拦截jsp文件?

问题描述: 一个简单的DEMO,在一个s1.jsp页面上提交一个form,发给springMVC的一个controller,然后返回一个s2.jsp显示之前提交的参数。 我在web.xml中,servlet配置的是拦截所有的请求发给springMVC,那为什么我能在浏览器中直接输入url打开s1.jsp(s1.jsp位于WebContent目录下)?如果在相同的目录下放置一个html文件,浏览器中直接输入url则会被拦截。 我不明白为什么springMVC默认不会拦截jsp?在哪里设置的? ![图片说明](https://img-ask.csdn.net/upload/201504/17/1429235425_812398.png)

Spring mvc 中的mapper.xml的SQL语句报错

### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=2,conn_timeout=1,resp_timeout=1,test_retry=1,freq=2,monit_conn_timeout=' at line 1 ### The error may involve com.security.dao.TemplateNetworkDao.updateTempNetwork-Inline ### The error occurred while setting parameters ### SQL: update conf_template_network set interval=?,conn_timeout=?,resp_timeout=?,test_retry=?,freq=?,monit_conn_timeout=?,monit_resp_timeout=?,monit_retry=? where id=? ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=2,conn_timeout=1,resp_timeout=1,test_retry=1,freq=2,monit_conn_timeout=' at line 1 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=2,conn_timeout=1,resp_timeout=1,test_retry=1,freq=2,monit_conn_timeout=' at line 1_ 我的SQL语句是 ``` <update id="updateTempNetwork" parameterType="int"> update conf_template_network set interval=#{interval},conn_timeout=#{conn_timeout},resp_timeout=#{resp_timeout},test_retry=#{test_retry},freq=#{freq},monit_conn_timeout=#{monit_conn_timeout},monit_resp_timeout=#{monit_resp_timeout},monit_retry=#{monit_retry} where id=#{id} </update> ``` 找了半天也没找到哪写错了,而且也没有使用mysql的关键字,提示说monit_conn_timeout附近的错误 # ## ——————————————————————————————————** # ## 更新:好像是SQL语句太长了,把前边的字段改短后,前边的字段就能正确显示,但是后边超出长度的部分还是会报错 我把前边长的字段用a,b替代之后,变短了: ``` <update id="updateTempNetwork" parameterType="com.security.entity.TemplateNetwork"> update conf_template_network set interval=#{interval},conn_timeout=#{conn_timeout},resp_timeout=#{resp_timeout},test_retry=#{test_retry},freq=#{freq},a=#{a},b=#{b},monit_retry=#{monit_retry} where id=#{id} </update> ``` 错误就移到了后边: Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=3,conn_timeout=3,resp_timeout=3,test_retry=3,freq=1,a=2,b=1,monit_retry' at line 1 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=3,conn_timeout=3,resp_timeout=3,test_retry=3,freq=1,a=2,b=1,monit_retry' at line 1 好像跟长度又没关系 把后边的字段都砍掉了之后 ``` <update id="updateTempNetwork" parameterType="com.security.entity.TemplateNetwork"> update conf_template_network set interval=#{interval},conn_timeout=#{conn_timeout},resp_timeout=#{resp_timeout},test_retry=#{test_retry},freq=#{freq} where id=#{id} </update> ``` 还是会报错: 移到了最后: ### SQL: update conf_template_network set interval=?,conn_timeout=?,resp_timeout=?,test_retry=?,freq=? where id=? ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=1,conn_timeout=2,resp_timeout=2,test_retry=1,freq=1 where id=1' at line 1 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=1,conn_timeout=2,resp_timeout=2,test_retry=1,freq=1 where id=1' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at $Proxy29.update(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at $Proxy37.updateTempNetwork(Unknown Source) at com.security.service.impl.TemplateNetworkImpl.updateTempNetwork(TemplateNetworkImpl.java:35) at com.security.service.impl.TemplateNetworkImpl$$FastClassBySpringCGLIB$$16455d80.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) at com.security.service.impl.TemplateNetworkImpl$$EnhancerBySpringCGLIB$$a87fea1.updateTempNetwork(<generated>) at com.security.controller.TemplateNetworkController.updateTempNetwork(TemplateNetworkController.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval=1,conn_timeout=2,resp_timeout=2,test_retry=1,freq=1 where id=1' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) at com.mysql.jdbc.Util.getInstance(Util.java:383) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2840) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1302) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) at $Proxy48.execute(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 结贴啦结帖啦! # 休息两天果然脑细胞就活过来了,周一一大早就找到了bug # interval是mySQL的关键字,用作变量名,所以报错了,换个名字就好了。已经是第二次撞到关键字了,以后起变量名要小心了。 # 非常感谢各位的帮助!!

spring mvc+shiro+cas 实现cas client功能 跳转回来404

http://securitycenter.com:8080/gtsys/cas?ticket=ST-14-HEDhc1GVQt0UYdiZpi7R-cas 返回这个地址 404 ![图片说明](https://img-ask.csdn.net/upload/201510/09/1444404164_27274.png) ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd" > <!-- 定时器开关 开始 --> <task:annotation-driven /> <!-- 标注类型 的事务配置 如果使用注解事务。就放开 <tx:annotation-driven />--> <!-- 统一异常处理方式 --> <bean id="exceptionHandler" class="com.lanyuan.exception.MyExceptionHandler"/> <!-- 初始化数据 --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > <property name ="locations"> <list> <value>classpath:jdbc.properties</value> </list> </property> <property name="ignoreUnresolvablePlaceholders" value="true" /> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="driverClassName" value="${jdbc.driverClass}" /> </bean> <bean id="pagePlugin" class="com.lanyuan.plugin.PagePlugin"> <property name="properties"> <props> <prop key="dialect">mysql</prop> <prop key="pageSqlId">.*query.*</prop> </props> </property> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 自动匹配Mapper映射文件 --> <property name="mapperLocations" value="classpath:mappings/*-mapper.xml"/> <property name="typeAliasesPackage" value="com.lanyuan.entity"/> <property name="plugins"> <array> <ref bean="pagePlugin" /> </array> </property> </bean> <!-- 通过扫描的模式,扫描目录在com.lanyuan.mapper目录下,所有的mapper都继承SqlMapper接口的接口, 这样一个bean就可以了 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.lanyuan.mapper" /> </bean> <!-- 事务配置 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- <aop:config> <aop:pointcut expression="execution(public * com.lanyuan.controller.*(..))" id="pointcut" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="query*" propagation="REQUIRED" read-only="true" /> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="modify*" propagation="REQUIRED" /> <tx:method name="logicDelById" propagation="REQUIRED" /> </tx:attributes> </tx:advice> --> <!-- <aop:aspectj-autoproxy proxy-target-class="true"/> <bean id="log4jHandlerAOP" class="com.lanyuan.logAop.LogAopAction"></bean> <aop:config proxy-target-class="true"> <aop:aspect id="logAspect" ref="log4jHandlerAOP"> <aop:pointcut id="logPointCut" expression="execution(* org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(..))" /> <aop:around method="logAll" pointcut-ref="logPointCut" /> </aop:aspect> </aop:config> --> <!-- 使用Spring组件扫描的方式来实现自动注入bean --> <context:component-scan base-package="com.lanyuan.task" /> <!-- 隐式地向 Spring 容器注册 --> <context:annotation-config /> </beans> spring-application.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd" > <tx:annotation-driven /> <context:component-scan base-package="com.lanyuan.controller" /> <context:component-scan base-package="com.lanyuan.logAop" /> <!-- 启动对@AspectJ注解的支持 --> <!--通知spring使用cglib而不是jdk的来生成代理方法 AOP可以拦截到Controller--> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 注解支持 --> <context:annotation-config/> <!--避免IE执行AJAX时,返回JSON出现下载文件 --> <bean id="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> <value>text/json;charset=UTF-8</value> <value>application/json;charset=UTF-8</value> </list> </property> </bean> <!-- 采用SpringMVC自带的JSON转换工具,支持@ResponseBody注解 --> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> <property name="messageConverters"> <list> <ref bean="mappingJackson2HttpMessageConverter" /> <!-- JSON转换器 --> </list> </property> </bean> <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/"></property> <property name="suffix" value=".jsp"></property> </bean> <mvc:annotation-driven> <!-- 处理responseBody 里面日期类型 --> <mvc:message-converters> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="objectMapper"> <bean class="com.fasterxml.jackson.databind.ObjectMapper"> <property name="dateFormat"> <bean class="java.text.SimpleDateFormat"> <constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" /> </bean> </property> </bean> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- 默认编码 --> <property name="defaultEncoding" value="utf-8" /> <!-- 文件大小最大值 --> <property name="maxUploadSize" value="10485760000" /> <!-- 内存中的最大值 --> <property name="maxInMemorySize" value="40960" /> </bean> <import resource="spring-mvc-shiro.xml"/> </beans> spring-mvc.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" > <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > <property name ="locations"> <list> <value>classpath:jdbc.properties</value> </list> </property> <property name="ignoreUnresolvablePlaceholders" value="true" /> </bean> <bean id="credentialsMatcher" class="com.lanyuan.shiro.credentials.RetryLimitHashedCredentialsMatcher"> <!-- hashAlgorithmName必须的,没有默认值。可以有MD5或者SHA-1,如果对密码安全有更高要求可以用SHA-256或者更高。 这里使用MD5 storedCredentialsHexEncoded默认是true,此时用的是密码加密用的是Hex编码;false时用Base64编码 hashIterations迭代次数,默认值是1。 --> <constructor-arg ref="cacheManager" /> <property name="hashAlgorithmName" value="md5" /> <!--<property name="hashIterations" value="2" />--> <!--<property name="storedCredentialsHexEncoded" value="true" />--> </bean> <!-- 会话Cookie模板 --> <bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie"> <!-- sid如果改为JSESSIONID会导致重定向循环 --> <constructor-arg value="sid"/> <property name="httpOnly" value="true"/> <property name="maxAge" value="-1"/> </bean> <bean id="rememberMeCookie" class="org.apache.shiro.web.servlet.SimpleCookie"> <constructor-arg value="rememberMe"/> <property name="httpOnly" value="true"/> <property name="maxAge" value="2592000"/><!-- 30天 --> </bean> <!-- rememberMe管理器 --> <bean id="rememberMeManager" class="org.apache.shiro.web.mgt.CookieRememberMeManager"> <!-- rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位)--> <property name="cipherKey" value="#{T(org.apache.shiro.codec.Base64).decode('4AvVhmFLUs0KTA3Kprsdag==')}"/> <property name="cookie" ref="rememberMeCookie"/> </bean> <bean id="casSubjectFactory" class="org.apache.shiro.cas.CasSubjectFactory"/> <!-- 凭证匹配器 --> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="casRealm" /> <property name="sessionManager" ref="sessionManager"/> <!-- 使用下面配置的缓存管理器 --> <property name="cacheManager" ref="cacheManager" /> <property name="rememberMeManager" ref="rememberMeManager"/> <property name="subjectFactory" ref="casSubjectFactory"/> </bean> <!-- 相当于调用SecurityUtils.setSecurityManager(securityManager) --> <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="staticMethod" value="org.apache.shiro.SecurityUtils.setSecurityManager"/> <property name="arguments" ref="securityManager"/> </bean> <!--自定义Realm --> <!-- <bean id="myRealm" class="com.lanyuan.shiro.MyRealm"> <property name="credentialsMatcher" ref="credentialsMatcher" /> <property name="cachingEnabled" value="false" /> --> <!-- 如需要自定义缓存时间放开以下.修改 ehcache.xml--> <!--<property name="authenticationCachingEnabled" value="true"/>--> <!--<property name="authenticationCacheName" value="authenticationCache"/>--> <!--<property name="authorizationCachingEnabled" value="true"/>--> <!--<property name="authorizationCacheName" value="authorizationCache"/>--> <!-- </bean> --> <!-- <property name="userService" ref="userService"/> --> <bean id="casRealm" class="com.lanyuan.shiro.MyCasRealm"> <property name="cachingEnabled" value="true"/> <property name="authenticationCachingEnabled" value="true"/> <property name="authenticationCacheName" value="authenticationCache"/> <property name="authorizationCachingEnabled" value="true"/> <property name="authorizationCacheName" value="authorizationCache"/> <!--该地址为cas server地址 --> <property name="casServerUrlPrefix" value="${shiro.casServer.url}"/> <!-- 该地址为是当前应用 CAS 服务 URL,即用于接收并处理登录成功后的 Ticket 的, 必须和loginUrl中的service参数保持一致,否则服务器会判断service不匹配--> <property name="casService" value="${shiro.client.cas}"/> </bean> <bean id="sysUserFilter" class="com.lanyuan.shiro.filter.SysUserFilter"/> <bean id="kickoutSessionControlFilter" class="com.lanyuan.shiro.filter.KickoutSessionControlFilter"> <property name="cacheManager" ref="cacheManager"/> <property name="sessionManager" ref="sessionManager"/> <property name="kickoutAfter" value="false"/> <property name="maxSession" value="1"/> <property name="kickoutUrl" value="/login.shtml"/> </bean> <bean id="casFilter" class="org.apache.shiro.cas.CasFilter"> <!--配置验证错误时的失败页面(Ticket 校验不通过时展示的错误页面) --> <property name="failureUrl" value="${shiro.failureUrl}"/> </bean> <bean id="casLogoutFilter" class="io.github.howiefh.cas.session.CasLogoutFilter"> <property name="sessionManager" ref="sessionManager"/> </bean> <bean id="logoutFilter" class="org.apache.shiro.web.filter.authc.LogoutFilter"> <property name="redirectUrl" value="${shiro.logout.url}"/> </bean> <!-- 配置shiro的过滤器工厂类,id- shiroFilter要和我们在web.xml中配置的过滤器一致 --> <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="securityManager" ref="securityManager" /> <!-- <property name="loginUrl" value="/login.shtml" /> <property name="successUrl" value="/index.shtml" /> --> <property name="loginUrl" value="${shiro.login.url}"/> <property name="successUrl" value="${shiro.login.success.url}"/> <property name="unauthorizedUrl" value="/denied.jsp" /> <!-- 自定义权限配置 --> <property name="filterChainDefinitionMap" ref="chainDefinitionSectionMetaSource" /> <property name="filters"> <util:map> <entry key="cas" value-ref="casFilter"/> <entry key="logout" value-ref="logoutFilter" /> <entry key="casLogout" value-ref="casLogoutFilter" /> <entry key="sysUser" value-ref="sysUserFilter"/> <entry key="kickout" value-ref="kickoutSessionControlFilter"/> </util:map> </property> </bean> <!--自定义filterChainDefinitionMap --> <bean id="chainDefinitionSectionMetaSource" class="com.lanyuan.shiro.ChainDefinitionSectionMetaSource"> <property name="filterChainDefinitions"> <value> /casFailure.jsp = anon /cas = casLogout,cas /logout = logout /favicon.ico = anon /admin_files/** = anon /fonts/** = anon /404/** = anon /error.jsp = anon /js/** = anon /layer-v1.9.2/** = anon /notebook/** = anon /login.shtml = anon /denied.jsp = anon /install.shtml = anon /lanyuan.shtml = anon /** = casLogout,user </value> </property> </bean> <bean id="sessionIdGenerator" class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator"/> <!-- 会话DAO --> <bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO"> <property name="activeSessionsCacheName" value="shiro-activeSessionCache"/> <property name="sessionIdGenerator" ref="sessionIdGenerator"/> </bean> <!-- 会话验证调度器 --> <!-- 全局的会话信息检测扫描信息间隔30分钟--> <bean id="sessionValidationScheduler" class="org.apache.shiro.session.mgt.quartz.QuartzSessionValidationScheduler"> <property name="sessionValidationInterval" value="1800000"/> <property name="sessionManager" ref="sessionManager"/> </bean> <!-- 会话管理器 --> <!-- 全局的会话信息设置成30分钟,sessionValidationSchedulerEnabled参数就是是否开启扫描 --> <bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"> <property name="globalSessionTimeout" value="1800000"/> <property name="deleteInvalidSessions" value="true"/> <property name="sessionValidationSchedulerEnabled" value="true"/> <property name="sessionValidationScheduler" ref="sessionValidationScheduler"/> <property name="sessionDAO" ref="sessionDAO"/> <property name="sessionIdCookieEnabled" value="true"/> <property name="sessionIdCookie" ref="sessionIdCookie"/> </bean> <!--shiro缓存管理器 --> <bean id="cacheManager" class="com.lanyuan.shiro.spring.SpringCacheManagerWrapper" > <property name="cacheManager" ref="springCacheManager"/> </bean> <bean id="springCacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> <property name="cacheManager" ref="ehcacheManager"/> </bean> <!--ehcache--> <bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="configLocation" value="classpath:ehcache.xml"/> </bean> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" /> </beans> spring-shiro.xml <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" metadata-complete="false"> <display-name>gtsys</display-name> <!-- 单点登出 --> <!-- <listener> <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class> </listener> <filter> <filter-name>CAS Single Sign Out Filter</filter-name> <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> </filter> <filter-mapping> <filter-name>CAS Single Sign Out Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-shiro.xml,classpath:spring-application.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <async-supported>true</async-supported> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.shtml</url-pattern> </servlet-mapping> <filter> <filter-name>encoding</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> --> <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.eot</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.ttf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.xml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.swf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.zip</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.woff</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>login.shtml</welcome-file> </welcome-file-list> </web-app> web.xml ## shiro shiro.session.timeout=1800000 shiro.session.validate.timespan=1800000 # cas\u767B\u5F55URL shiro.login.url=https://localhost:8443/cas-server/login?service=http://securitycenter.com:8080/gtsys/cas # cas logout shiro.logout.url=https://localhost:8443/cas-server/logout?service=http://securitycenter.com:8080/gtsys # cas\u767B\u5F55\u6210\u529F\u8DF3\u8F6CURL shiro.login.success.url=http://securitycenter.com:8080/gtsys/index.shtml # cas\u670D\u52A1\u5668URL shiro.casServer.url=https://localhost:8443/cas-server # \u5BA2\u6237\u7AEFCAS\u767B\u5F55URL shiro.client.cas=http://securitycenter.com:8080/gtsys/cas # \u5BA2\u6237\u7AEFCAS\u9A8C\u8BC1\u5931\u8D25\u8DF3\u8F6CURL shiro.failureUrl=/casFailure.jsp ## dataSource dataSource.driver=com.mysql.jdbc.Driver dataSource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8 dataSource.username=root dataSource.password=1234 properties文件 <?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true"> <diskStore path="java.io.tmpdir"/> <!-- <diskStore>==========当内存缓存中对象数量超过maxElementsInMemory时,将缓存对象写到磁盘缓存中(需对象实现序列化接口) * <diskStore path="">==用来配置磁盘缓存使用的物理路径,Ehcache磁盘缓存使用的文件后缀名是*.data和*.index * name=================缓存名称,cache的唯一标识(ehcache会把这个cache放到HashMap里) * maxElementsOnDisk====磁盘缓存中最多可以存放的元素数量,0表示无穷大 * maxElementsInMemory==内存缓存中最多可以存放的元素数量,若放入Cache中的元素超过这个数值,则有以下两种情况 * 1)若overflowToDisk=true,则会将Cache中多出的元素放入磁盘文件中 * 2)若overflowToDisk=false,则根据memoryStoreEvictionPolicy策略替换Cache中原有的元素 * eternal==============缓存中对象是否永久有效,即是否永驻内存,true时将忽略timeToIdleSeconds和timeToLiveSeconds * timeToIdleSeconds====缓存数据在失效前的允许闲置时间(单位:秒),仅当eternal=false时使用,默认值是0表示可闲置时间无穷大,此为可选属性 * 即访问这个cache中元素的最大间隔时间,若超过这个时间没有访问此Cache中的某个元素,那么此元素将被从Cache中清除 * timeToLiveSeconds====缓存数据在失效前的允许存活时间(单位:秒),仅当eternal=false时使用,默认值是0表示可存活时间无穷大 * 即Cache中的某元素从创建到清楚的生存时间,也就是说从创建开始计时,当超过这个时间时,此元素将从Cache中清除 * overflowToDisk=======内存不足时,是否启用磁盘缓存(即内存中对象数量达到maxElementsInMemory时,Ehcache会将对象写到磁盘中) * 会根据标签中path值查找对应的属性值,写入磁盘的文件会放在path文件夹下,文件的名称是cache的名称,后缀名是data * diskPersistent=======是否持久化磁盘缓存,当这个属性的值为true时,系统在初始化时会在磁盘中查找文件名为cache名称,后缀名为index的文件 * 这个文件中存放了已经持久化在磁盘中的cache的index,找到后会把cache加载到内存 * 要想把cache真正持久化到磁盘,写程序时注意执行net.sf.ehcache.Cache.put(Element element)后要调用flush()方法 * diskExpiryThreadIntervalSeconds==磁盘缓存的清理线程运行间隔,默认是120秒 * diskSpoolBufferSizeMB============设置DiskStore(磁盘缓存)的缓存区大小,默认是30MB * memoryStoreEvictionPolicy========内存存储与释放策略,即达到maxElementsInMemory限制时,Ehcache会根据指定策略清理内存 * 共有三种策略,分别为LRU(最近最少使用)、LFU(最常用的)、FIFO(先进先出) --> <!-- 注意,以下缓存是永久有效,是系统初始化数据到缓存中,如果不需要永久有效,请另写,或在 --> <cache name="cache" maxEntriesLocalHeap="10000" maxEntriesLocalDisk="1000" eternal="true" diskSpoolBufferSizeMB="20" timeToIdleSeconds="0" timeToLiveSeconds="0" memoryStoreEvictionPolicy="LFU" transactionalMode="off"> </cache> <!-- 登录记录缓存 锁定10分钟 --> <cache name="passwordRetryCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="600" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> <!-- <cache name="authorizationCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> <cache name="authenticationCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> --> <cache name="shiro-activeSessionCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> <cache name="shiro-kickout-session" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> </ehcache> ehcache.xml package com.lanyuan.shiro; //import com.github.zhangkaitao.shiro.chapter15.service.UserService; import java.util.List; import javax.inject.Inject; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.cas.CasRealm; import org.apache.shiro.subject.PrincipalCollection; import com.lanyuan.entity.ResFormMap; import com.lanyuan.mapper.ResourcesMapper; import com.lanyuan.mapper.UserMapper; /** * <p>User: Zhang Kaitao * <p>Date: 14-2-13 * <p>Version: 1.0 */ public class MyCasRealm extends CasRealm { // private UserService userService; // // public void setUserService(UserService userService) { // this.userService = userService; // } @Inject private ResourcesMapper resourcesMapper; @Inject private UserMapper userMapper; @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { String username = (String)principals.getPrimaryPrincipal(); // PathMatchingFilterChainResolver SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); //authorizationInfo.setRoles(userService.findRoles(username)); // authorizationInfo.setStringPermissions(userService.findPermissions(username)); String userId = SecurityUtils.getSubject().getSession().getAttribute("userSessionId").toString(); List<ResFormMap> rs = resourcesMapper.findUserResourcess(userId); for (ResFormMap resources : rs) { authorizationInfo.addStringPermission(resources.get("resKey").toString()); } return authorizationInfo; } } MyCasRealm.java ``` ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <aop:config proxy-target-class="true"></aop:config> <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"> <property name="securityManager" ref="securityManager"/> </bean> </beans> spring-mvc-shiro.xml ``` 这个是更改 网上的蓝缘系统的 cas server 和cas client参考的 http://howiefh.github.io/2015/05/19/shiro-cas-single-sign-on/?utm_source=tuicool 不知道为什么会返回404

spring mvc拦截器无法拦截DWZ的请求,求指点。。。

拦截器是这样配置的: [code="xml"] <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/*" > </mvc:mapping>如果不配置或/*,将拦截所有的Controller <bean class="com.hangzhou.controller.interceptor.LoginInterceptor"></bean> </mvc:interceptor> </mvc:interceptors> [/code] 在访问系统根路径:http://localhost:8080/HZ 时拦截器可以拦截到请求,但是当我店里面的请求的时候,就不行了,请大家找找解决的办法啊。指点一下

Spring MVC 怎么在异常@ExceptionHandler方法里返回页面

@ExceptionHandler public ResponseEntity<?> handlerException() { //返回指定页面 }

SSM拦截器,为什么只能拦截controller请求,确不能拦截所以请求

<mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <mvc:exclude-mapping path="/html/login.jsp"/> <mvc:exclude-mapping path="/pro/some.do"/> <mvc:exclude-mapping path="css"/> <mvc:exclude-mapping path="images"/> <mvc:exclude-mapping path="jq"/> <mvc:exclude-mapping path="js"/> <mvc:exclude-mapping path="/jquery-3.2.1.js"/> <mvc:exclude-mapping path="/jquery-form.js"/> <bean class="com.aynu.interceptor.MyInterceptor"/> </mvc:interceptor> </mvc:interceptors> 大神们,我想通过这个拦截器,如果地址栏里输出其他地址不能直接访问,这该怎么拦截呢? 现在只能拦截到controller

新手spring,controller没有被调用问题

在index.jsp上登录——>login.jsp页面。 login.jsp上有两个静态的连接add.jsp和sel.jsp 然后点add.jsp 是一个添加用户的表单 输入数据提交后 没有任何显示 debug报: 2015-11-20 11:06:56,613 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Looking up handler method for path /view/adduser 2015-11-20 11:06:56,616 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Did not find handler method for [/view/adduser] 2015-11-20 11:06:56,617 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - Matching patterns for request [/view/adduser] are [/**] 2015-11-20 11:06:56,617 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - URI Template variables for request [/view/adduser] are {} 2015-11-20 11:06:56,617 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - Mapping [/view/adduser] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@6aa25d] and 1 interceptor 2015-11-20 11:06:56,618 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.DispatcherServlet] - Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling 2015-11-20 11:06:56,618 [http-bio-9090-exec-10] DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request 我的controller : @RequestMapping("/adduser") public ModelAndView addUser(ModelMap model, HttpServletRequest request, HttpServletResponse response) { ModelAndView mav = new ModelAndView("adduser"); System.out.println("添加controller被调用"); Integer userId = Integer.parseInt(request.getParameter("id").trim()); String userName = request.getParameter("uname").trim(); String userPassword = request.getParameter("upass").trim(); String userEmail = request.getParameter("email"); User user =userService.addUser(userId, userName, userPassword, userEmail); System.out.println(user); return mav; } <mvc:annotation-driven /> <mvc:default-servlet-handler /> 的配置和 <!-- 拦截设置 --> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>都有配置。 控制台上并没有被调用的信息。请问为什么?

基于注解SpringMvc拦截器无法使用

在我自定义的拦截器中打了断点一直无法进入,拦截器定义在controllers.xml中 代码如下帮忙解决下,谢谢 [code="java"] package com.core.Interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; /** * 拦截器 */ public class BasedInterceptor extends HandlerInterceptorAdapter { //预处理 public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HttpSession sesson = request.getSession(); if(sesson.getAttribute("user") == null){ request.getRequestDispatcher("index.jsp").forward(request, response); return false; } return true; } public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { request.getRequestDispatcher("index.jsp").forward(request, response); } public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { request.getRequestDispatcher("index.jsp").forward(request, response); } } [/code] web.xml [code="xml"] <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>SpringTest</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext*.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 对像js,css,gif等静态文件的访问,需要映射到默认的servlet --> <!-- 这里省去对静态资源url的配置,当然这样的话tomcat控制台就会报警告了,对html的请求、页面中的图片及css效果也是无法访问的 不过我们这是搭基本环境嘛,就先不要图片吧,如果想解决这个问题,可以看我另外一篇文章: --> <!-- 配置spring核心servlet --> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> <!-- url配置为/,不带文件后缀,会造成其它静态文件(js,css等)不能访问。如配为*.do,则不影响静态文件的访问 --> </servlet-mapping> <!-- Spring 刷新Introspector防止内存泄露 --> <listener> <listener-class> org.springframework.web.util.IntrospectorCleanupListener </listener-class> </listener> <!-- 字符编码过滤器 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>GBK</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <!-- 欢迎页面 --> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> [/code] servlet-context.xml [code="xml"] <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <!-- Configures the @Controller programming model 必须加上这个,不然请求controller时会出现no mapping url错误--> <mvc:annotation-driven /> <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/jsp directory --> <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/view/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="utf-8" /> <!-- Imports user-defined @Controller beans that process client requests --> <beans:import resource="controllers.xml" /> </beans:beans> [/code] controllers.xml [code="xml"] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd" default-autowire="byName"> <!-- Maps '/' requests to the 'home' view <mvc:view-controller path="*.do" view-name="home"/>--> <!-- enable autowire --> <context:annotation-config /> <!--拦截器--> <bean id="basedAccessInterceptor" class="com.core.Interceptor.BasedInterceptor"/> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="interceptors"> <list> <ref bean="basedAccessInterceptor"/> </list> </property> </bean> <!-- 扫描业务组件 --> <context:component-scan base-package="com.mvc.controller" /> </beans> [/code]

spring mvc 事务失效问题

<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p><span style="color: #000000;"><strong>同时向两个表插入数据,第一条成功,第二条数据插入失败,第一条未回滚,具体配置如下</strong></span></p> <p> </p> <p><span style="color: #000000; font-size: 18px;"><strong>applicationContext.xml 代码</strong></span></p> <p><span style="color: #000000;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span><br><span style="color: #000000;">&lt;beans xmlns="<a href="http://www.springframework.org/schema/beans"><span style="color: #000000;">http://www.springframework.org/schema/beans</span></a>"</span><br><span style="color: #000000;"> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance"><span style="color: #000000;">http://www.w3.org/2001/XMLSchema-instance</span></a>" xmlns:tx="<a href="http://www.springframework.org/schema/tx"><span style="color: #000000;">http://www.springframework.org/schema/tx</span></a>"</span><br><span style="color: #000000;"> xmlns:context="<a href="http://www.springframework.org/schema/context"><span style="color: #000000;">http://www.springframework.org/schema/context</span></a>"</span><br><span style="color: #000000;"> xmlns:mvc="<a href="http://www.springframework.org/schema/mvc"><span style="color: #000000;">http://www.springframework.org/schema/mvc</span></a>" xmlns:util="<a href="http://www.springframework.org/schema/util"><span style="color: #000000;">http://www.springframework.org/schema/util</span></a>"</span><br><span style="color: #000000;"> xmlns:aop="<a href="http://www.springframework.org/schema/aop"><span style="color: #000000;">http://www.springframework.org/schema/aop</span></a>"</span><br><span style="color: #000000;"> xsi:schemaLocation="<a href="http://www.springframework.org/schema/aop"><span style="color: #000000;">http://www.springframework.org/schema/aop</span></a> <a href="http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/aop/spring-aop-3.1.xsd</span></a></span><br><span style="color: #000000;">  <a href="http://www.springframework.org/schema/mvc"><span style="color: #000000;">http://www.springframework.org/schema/mvc</span></a> <a href="http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd</span></a></span><br><span style="color: #000000;">  <a href="http://www.springframework.org/schema/beans"><span style="color: #000000;">http://www.springframework.org/schema/beans</span></a> <a href="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/beans/spring-beans-3.1.xsd</span></a></span><br><span style="color: #000000;">  <a href="http://www.springframework.org/schema/util"><span style="color: #000000;">http://www.springframework.org/schema/util</span></a> <a href="http://www.springframework.org/schema/util/spring-util-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/util/spring-util-3.1.xsd</span></a></span><br><span style="color: #000000;">  <a href="http://www.springframework.org/schema/tx"><span style="color: #000000;">http://www.springframework.org/schema/tx</span></a> <a href="http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/tx/spring-tx-3.1.xsd</span></a></span><br><span style="color: #000000;">  <a href="http://www.springframework.org/schema/context"><span style="color: #000000;">http://www.springframework.org/schema/context</span></a> <a href="http://www.springframework.org/schema/context/spring-context-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/context/spring-context-3.1.xsd</span></a>"&gt;</span></p> <p><span style="color: #000000;"> &lt;!--将@Controller的注解排除掉 --&gt;</span><br><span style="color: #000000;"> &lt;context:component-scan base-package="com"&gt;</span><br><span style="color: #000000;">  &lt;context:exclude-filter type="annotation"</span><br><span style="color: #000000;">   expression="org.springframework.stereotype.Controller" /&gt;</span><br><span style="color: #000000;"> &lt;/context:component-scan&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 读取配置文件 --&gt;</span><br><span style="color: #000000;"> &lt;util:properties id="settings"</span><br><span style="color: #000000;">  location="classpath:config/global.properties" /&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 读取数据库配置文件 --&gt;</span><br><span style="color: #000000;"> &lt;bean id="configProperties"</span><br><span style="color: #000000;">  class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;</span><br><span style="color: #000000;">  &lt;property name="locations"&gt;</span><br><span style="color: #000000;">   &lt;list&gt;</span><br><span style="color: #000000;">    &lt;value&gt;classpath:config/jdbc.properties&lt;/value&gt;</span><br><span style="color: #000000;">   &lt;/list&gt;</span><br><span style="color: #000000;">  &lt;/property&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;bean id="propertyConfigurer"</span><br><span style="color: #000000;">  class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"&gt;</span><br><span style="color: #000000;">  &lt;property name="properties" ref="configProperties" /&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;mvc:annotation-driven /&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 数据源 --&gt;</span><br><span style="color: #000000;"> &lt;bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"&gt;</span><br><span style="color: #000000;">  &lt;property name="driver" value="${driver}" /&gt;</span><br><span style="color: #000000;">  &lt;property name="driverUrl" value="${driverUrl}" /&gt;</span><br><span style="color: #000000;">  &lt;property name="user" value="${user}" /&gt;</span><br><span style="color: #000000;">  &lt;property name="password" value="${password}" /&gt;</span><br><span style="color: #000000;">  &lt;property name="alias" value="proxool.aidecenter" /&gt;</span><br><span style="color: #000000;">  &lt;property name="maximumActiveTime" value="300000" /&gt;</span><br><span style="color: #000000;">  &lt;property name="prototypeCount" value="0" /&gt;</span><br><span style="color: #000000;">  &lt;property name="maximumConnectionCount" value="${maximumConnectionCount}" /&gt;</span><br><span style="color: #000000;">  &lt;property name="minimumConnectionCount" value="${minimumConnectionCount}" /&gt;</span><br><span style="color: #000000;">  &lt;property name="simultaneousBuildThrottle" value="50" /&gt;</span><br><span style="color: #000000;">  &lt;property name="houseKeepingTestSql" value="select form CURRENT_DATE" /&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;!-- JDBC模版 --&gt;</span><br><span style="color: #000000;"> &lt;bean id="jdbc" class="org.springframework.jdbc.core.JdbcTemplate"&gt;</span><br><span style="color: #000000;">  &lt;property name="dataSource" ref="dataSource" /&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;bean</span><br><span style="color: #000000;">  class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"&gt;</span><br><span style="color: #000000;">  &lt;property name="staticMethod" value="com.common.database.SpringDB.setJdbcTemplate" /&gt;</span><br><span style="color: #000000;">  &lt;property name="arguments" ref="jdbc" /&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;!-- 事务管理器 --&gt;</span><br><span style="color: #000000;"> &lt;bean id="transactionManager"</span><br><span style="color: #000000;">  class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;</span><br><span style="color: #000000;">  &lt;property name="dataSource"&gt;</span><br><span style="color: #000000;">   &lt;ref local="dataSource" /&gt;</span><br><span style="color: #000000;">  &lt;/property&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;!-- 事务模板 --&gt;</span><br><span style="color: #000000;"> &lt;bean id="transactionTemplate"</span><br><span style="color: #000000;">  class="org.springframework.transaction.support.TransactionTemplate"&gt;</span><br><span style="color: #000000;">  &lt;property name="transactionManager"&gt;</span><br><span style="color: #000000;">   &lt;ref local="transactionManager" /&gt;</span><br><span style="color: #000000;">  &lt;/property&gt;</span><br><span style="color: #000000;"> &lt;/bean&gt;</span><br><span style="color: #000000;"> &lt;aop:config&gt;</span><br><span style="color: #000000;">  &lt;aop:pointcut id="transactionPointcut"</span><br><span style="color: #000000;">   expression="execution(* com.service..*.*(..))" /&gt;</span><br><span style="color: #000000;">  &lt;aop:advisor pointcut-ref="transactionPointcut"</span><br><span style="color: #000000;">   advice-ref="advice" /&gt;</span><br><span style="color: #000000;"> &lt;/aop:config&gt;</span><br><span style="color: #000000;"> &lt;tx:advice id="advice" transaction-manager="transactionManager"&gt;</span><br><span style="color: #000000;">  &lt;tx:attributes&gt;</span><br><span style="color: #000000;">   &lt;!-- 读取数据方法,一般采用只读事务 --&gt;</span><br><span style="color: #000000;">   &lt;tx:method name="find*" read-only="true" /&gt;</span><br><span style="color: #000000;">   &lt;!--以下方法,如save,update,delete等对数据库进行写入操作的方法,当产生Exception时进行回滚 --&gt;</span><br><span style="color: #000000;">   &lt;tx:method name="save*" propagation="REQUIRED" /&gt;</span><br><span style="color: #000000;">   &lt;tx:method name="update*" /&gt;</span><br><span style="color: #000000;">   &lt;tx:method name="delete*" /&gt;</span><br><span style="color: #000000;">  &lt;/tx:attributes&gt;</span><br><span style="color: #000000;"> &lt;/tx:advice&gt;</span><br><span style="color: #000000;"> &lt;tx:annotation-driven transaction-manager="transactionManager"</span><br><span style="color: #000000;">  proxy-target-class="true" /&gt;</span><br><span style="color: #000000;">&lt;/beans&gt;</span></p> <p> </p> <p><span style="color: #000000; font-size: 18px;"><strong>dispatcher-servlet.xml</strong></span></p> <p><span style="color: #000000;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans xmlns="<a href="http://www.springframework.org/schema/beans"><span style="color: #000000;">http://www.springframework.org/schema/beans</span></a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance"><span style="color: #000000;">http://www.w3.org/2001/XMLSchema-instance</span></a>" xmlns:context="<a href="http://www.springframework.org/schema/context"><span style="color: #000000;">http://www.springframework.org/schema/context</span></a>"<br> xmlns:cache="<a href="http://www.springframework.org/schema/cache"><span style="color: #000000;">http://www.springframework.org/schema/cache</span></a>" xmlns:aop="<a href="http://www.springframework.org/schema/aop"><span style="color: #000000;">http://www.springframework.org/schema/aop</span></a>"<br> xmlns:tx="<a href="http://www.springframework.org/schema/tx"><span style="color: #000000;">http://www.springframework.org/schema/tx</span></a>" xmlns:jdbc="<a href="http://www.springframework.org/schema/jdbc"><span style="color: #000000;">http://www.springframework.org/schema/jdbc</span></a>"<br> xmlns:mvc="<a href="http://www.springframework.org/schema/mvc"><span style="color: #000000;">http://www.springframework.org/schema/mvc</span></a>"<br> xsi:schemaLocation="<br>      <a href="http://www.springframework.org/schema/beans"><span style="color: #000000;">http://www.springframework.org/schema/beans</span></a>  <br>            <a href="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/beans/spring-beans-3.1.xsd</span></a>  <br>            <a href="http://www.springframework.org/schema/context"><span style="color: #000000;">http://www.springframework.org/schema/context</span></a>  <br>            <a href="http://www.springframework.org/schema/context/spring-context-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/context/spring-context-3.1.xsd</span></a>  <br>            <a href="http://www.springframework.org/schema/tx"><span style="color: #000000;">http://www.springframework.org/schema/tx</span></a>  <br>            <a href="http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/tx/spring-tx-3.1.xsd</span></a>  <br>            <a href="http://www.springframework.org/schema/jdbc"><span style="color: #000000;">http://www.springframework.org/schema/jdbc</span></a>  <br>            <a href="http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd</span></a><br>            <a href="http://www.springframework.org/schema/cache"><span style="color: #000000;">http://www.springframework.org/schema/cache</span></a> <br>            <a href="http://www.springframework.org/schema/cache/spring-cache-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/cache/spring-cache-3.1.xsd</span></a><br>            <a href="http://www.springframework.org/schema/mvc"><span style="color: #000000;">http://www.springframework.org/schema/mvc</span></a> <br>      <a href="http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"><span style="color: #000000;">http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd</span></a>"<br> default-autowire="byName"&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 将@Service注解给去掉 --&gt;<br> &lt;context:component-scan base-package="com.controller"&gt;<br>  &lt;context:include-filter type="annotation"<br>   expression="org.springframework.stereotype.Controller" /&gt;<br>  &lt;context:exclude-filter type="annotation"<br>   expression="org.springframework.stereotype.Service" /&gt;<br> &lt;/context:component-scan&gt;</span></p> <p><span style="color: #000000;"> &lt;bean<br>  class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"&gt;<br>  &lt;property name="useSuffixPatternMatch" value="true" /&gt;<br>  &lt;property name="interceptors"&gt;<br>   &lt;list&gt;<br>    &lt;ref bean="sessionInterceptor"&gt;&lt;/ref&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 --&gt;<br> &lt;bean<br>  class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;<br>  &lt;property name="messageConverters"&gt;<br>   &lt;list&gt;<br>    &lt;ref bean="mappingJacksonHttpMessageConverter" /&gt;<br>    &lt;ref bean="stringHttpMessageConverter" /&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;!-- 负责读写字符串格式的数据 --&gt;<br> &lt;bean id="stringHttpMessageConverter"<br>  class="org.springframework.http.converter.StringHttpMessageConverter"&gt;<br>  &lt;property name="supportedMediaTypes"&gt;<br>   &lt;list&gt;<br>    &lt;value&gt;text/plain;charset=UTF-8&lt;/value&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;!-- 负责读写入json格式的数据 --&gt;<br> &lt;bean id="mappingJacksonHttpMessageConverter"<br>  class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"&gt;<br>  &lt;property name="supportedMediaTypes"&gt;<br>   &lt;list&gt;<br>    &lt;value&gt;application/json;charset=UTF-8&lt;/value&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 拦截器 --&gt;<br> &lt;bean id="sessionInterceptor" class="com.interceptor.SessionInterceptor"&gt;&lt;/bean&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 --&gt;<br> &lt;bean id="viewResolver"<br>  class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;<br>  &lt;property name="viewClass"<br>   value="org.springframework.web.servlet.view.JstlView" /&gt;<br>  &lt;property name="prefix" value="" /&gt;<br>  &lt;property name="suffix" value=".jsp" /&gt;<br> &lt;/bean&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 启用缓存注解功能,该注解一定要声明在Spring主配置文件中才会生效 --&gt;<br> &lt;cache:annotation-driven cache-manager="cacheManager" /&gt;<br> &lt;bean id="cacheManager"<br>  class="org.springframework.cache.concurrent.ConcurrentMapCacheManager" /&gt;</span></p> <p><span style="color: #000000;"> &lt;!-- 资源文件加载 --&gt;<br> &lt;mvc:resources mapping="/upload/**" location="/upload/"<br>  cache-period="31556926" /&gt;<br> &lt;mvc:resources mapping="/libs/**" location="/libs/"<br>  cache-period="31556926" /&gt;<br>&lt;/beans&gt;<strong><br>上传的图片为包结构</strong></span></p> <p> </p> <p><span style="color: #000000;"><strong>Service的注解在接口实现类中</strong></span></p> <p><span style="color: #000000;"><strong>@Service<br>@Transactional<br>public class SiteServiceImpl implements SiteService {</strong></span></p> <p><span style="color: #000000;"><strong>.......</strong></span></p> <p><span style="color: #000000;"><strong>}</strong></span></p> <p> </p> <p><span style="color: #000000;">请问是哪里配置错了么</span></p> </div>

springmvc统一异常处理

我最近在做异常统一处理,按照网上配置,但是报出异常也能捕捉到异常,但是就是跳转不到配合过的异常页面。 在项目中点击请求一个url,报出异常不跳转错误页面,但是把请求的url单独拿到浏览器上请求可以跳转到错误页面,请问各位大神有没有知道是什么原因的? 我的配置如下: ![图片说明](https://img-ask.csdn.net/upload/201802/28/1519789622_249548.png) 在项目页面上点击触发异常 ![图片说明](https://img-ask.csdn.net/upload/201802/28/1519790045_468962.png) ![图片说明](https://img-ask.csdn.net/upload/201802/28/1519790055_98719.png) 但是页面没有反应,没有跳转到异常页面,但是将url单独拿到浏览器请求会转发到异常页面

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:csdn590)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

Windows版YOLOv4目标检测实战:训练自己的数据集

课程演示环境:Windows10; cuda 10.2; cudnn7.6.5; Python3.7; VisualStudio2019; OpenCV3.4 需要学习ubuntu系统上YOLOv4的同学请前往:《YOLOv4目标检测实战:训练自己的数据集》 课程链接:https://edu.csdn.net/course/detail/28745 YOLOv4来了!速度和精度双提升! 与 YOLOv3 相比,新版本的 AP (精度)和 FPS (每秒帧率)分别提高了 10% 和 12%。 YOLO系列是基于深度学习的端到端实时目标检测方法。本课程将手把手地教大家使用labelImg标注和使用YOLOv4训练自己的数据集。课程实战分为两个项目:单目标检测(足球目标检测)和多目标检测(足球和梅西同时检测)。 本课程的YOLOv4使用AlexyAB/darknet,在Windows系统上做项目演示。包括:安装软件环境、安装YOLOv4、标注自己的数据集、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算)和先验框聚类分析。还将介绍改善YOLOv4目标检测性能的技巧。 除本课程《Windows版YOLOv4目标检测实战:训练自己的数据集》外,本人将推出有关YOLOv4目标检测的系列课程。请持续关注该系列的其它视频课程,包括: 《Windows版YOLOv4目标检测实战:人脸口罩佩戴检测》 《Windows版YOLOv4目标检测实战:中国交通标志识别》 《Windows版YOLOv4目标检测:原理与源码解析》

lena全身原图(非256*256版本,而是全身原图)

lena全身原图(非256*256版本,而是全身原图) lena原图很有意思,我们通常所用的256*256图片是在lena原图上截取了头部部分的256*256正方形得到的. 原图是花花公子杂志上的一个

快速入门Android开发 视频 教程 android studio

这是一门快速入门Android开发课程,顾名思义是让大家能快速入门Android开发。 学完能让你学会如下知识点: Android的发展历程 搭建Java开发环境 搭建Android开发环境 Android Studio基础使用方法 Android Studio创建项目 项目运行到模拟器 项目运行到真实手机 Android中常用控件 排查开发中的错误 Android中请求网络 常用Android开发命令 快速入门Gradle构建系统 项目实战:看美图 常用Android Studio使用技巧 项目签名打包 如何上架市场

Java调用微信支付

Java 使用微信支付 一. 准备工作 1.

汽车租赁管理系统需求分析规格说明书

汽车租赁管理系统需求分析规格说明书,这只是一个模板,如果有不会的可以借鉴一下,还是蛮详细的。。。。

C/C++跨平台研发从基础到高阶实战系列套餐

一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,

程序员的算法通关课:知己知彼(第一季)

【超实用课程内容】 程序员对于算法一直又爱又恨!特别是在求职面试时,算法类问题绝对是不可逃避的提问点!本门课程作为算法面试系列的第一季,会从“知己知彼”的角度,聊聊关于算法面试的那些事~ 【哪些人适合学习这门课程?】 求职中的开发者,对于面试算法阶段缺少经验 想了解实际工作中算法相关知识 在职程序员,算法基础薄弱,急需充电 【超人气讲师】 孙秀洋&nbsp;| 服务器端工程师 硕士毕业于哈工大计算机科学与技术专业,ACM亚洲区赛铜奖获得者,先后在腾讯和百度从事一线技术研发,对算法和后端技术有深刻见解。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27272 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程无限观看时长,但是大家可以抓紧时间学习后一起讨论哦~

机器学习初学者必会的案例精讲

通过六个实际的编码项目,带领同学入门人工智能。这些项目涉及机器学习(回归,分类,聚类),深度学习(神经网络),底层数学算法,Weka数据挖掘,利用Git开源项目实战等。

Python入门视频精讲

Python入门视频培训课程以通俗易懂的方式讲解Python核心技术,Python基础,Python入门。适合初学者的教程,让你少走弯路! 课程内容包括:1.Python简介和安装 、2.第一个Python程序、PyCharm的使用 、3.Python基础、4.函数、5.高级特性、6.面向对象、7.模块、8.异常处理和IO操作、9.访问数据库MySQL。教学全程采用笔记+代码案例的形式讲解,通俗易懂!!!

我以为我对Mysql事务很熟,直到我遇到了阿里面试官

太惨了,面试又被吊打

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

Java62数据提取代码

利用苹果手机微信下面的wx.data文件提取出62数据,通过62可以实现不同设备直接登陆,可以通过文件流的方式用脚本上传到服务器进行解析

Python代码实现飞机大战

文章目录经典飞机大战一.游戏设定二.我方飞机三.敌方飞机四.发射子弹五.发放补给包六.主模块 经典飞机大战 源代码以及素材资料(图片,音频)可从下面的github中下载: 飞机大战源代码以及素材资料github项目地址链接 ————————————————————————————————————————————————————————— 不知道大家有没有打过飞机,喜不喜欢打飞机。当我第一次接触这个东西的时候,我的内心是被震撼到的。第一次接触打飞机的时候作者本人是身心愉悦的,因为周边的朋友都在打飞机, 每

2018年全国大学生计算机技能应用大赛决赛 大题

2018年全国大学生计算机技能应用大赛决赛大题,程序填空和程序设计(侵删)

Lena图像处理测试专业用图,高清完整全身原图

Lena图像处理测试专业用图,高清完整全身原图,该图片很好的包含了平坦区域、阴影和纹理等细节,这些都有益于测试各种不同的图像处理算法。它是一幅很好的测试照片!其次,由于这是一个非常有魅力女人的照片。

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

verilog实现地铁系统售票

使用 verilog 实现地铁售票

Python+OpenCV计算机视觉

Python+OpenCV计算机视觉系统全面的介绍。

Python可以这样学(第四季:数据分析与科学计算可视化)

董付国老师系列教材《Python程序设计(第2版)》(ISBN:9787302436515)、《Python可以这样学》(ISBN:9787302456469)配套视频,在教材基础上又增加了大量内容,通过实例讲解numpy、scipy、pandas、statistics、matplotlib等标准库和扩展库用法。

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

获取Linux下Ftp目录树并逐步绑定到treeview

在linux下抓取目录树,双击后获取该节点子节点(逐步生成)。另外有两个类,一个是windows下的(一次性获取目录树),一个是linux下的(足部获取目录树)

YOLOv3目标检测实战系列课程

《YOLOv3目标检测实战系列课程》旨在帮助大家掌握YOLOv3目标检测的训练、原理、源码与网络模型改进方法。 本课程的YOLOv3使用原作darknet(c语言编写),在Ubuntu系统上做项目演示。 本系列课程包括三门课: (1)《YOLOv3目标检测实战:训练自己的数据集》 包括:安装darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 (2)《YOLOv3目标检测:原理与源码解析》讲解YOLOv1、YOLOv2、YOLOv3的原理、程序流程并解析各层的源码。 (3)《YOLOv3目标检测:网络模型改进方法》讲解YOLOv3的改进方法,包括改进1:不显示指定类别目标的方法 (增加功能) ;改进2:合并BN层到卷积层 (加快推理速度) ; 改进3:使用GIoU指标和损失函数 (提高检测精度) ;改进4:tiny YOLOv3 (简化网络模型)并介绍 AlexeyAB/darknet项目。

手把手实现Java图书管理系统(附源码)

【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

Java 最常见的 200+ 面试题:面试必备

这份面试清单是从我 2015 年做了 TeamLeader 之后开始收集的,一方面是给公司招聘用,另一方面是想用它来挖掘在 Java 技术栈中,还有那些知识点是我不知道的,我想找到这些技术盲点,然后修复它,以此来提高自己的技术水平。虽然我是从 2009 年就开始参加编程工作了,但我依旧觉得自己现在要学的东西很多,并且学习这些知识,让我很有成就感和满足感,那所以何乐而不为呢? 说回面试的事,这份面试...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

微信小程序 实例汇总 完整项目源代码

微信小程序 实例汇总 完整项目源代码

基于西门子S7—1200的单部六层电梯设计程序,1部6层电梯

基于西门子S7—1200的单部六层电梯设计程序,1部6层电梯。 本系统控制六层电梯, 采用集选控制方式。 为了完成设定的控制任务, 主要根据电梯输入/输出点数确定PLC 的机型。 根据电梯控制的要求,

相关热词 c#中如何设置提交按钮 c#帮助怎么用 c# 读取合并单元格的值 c#带阻程序 c# 替换span内容 c# rpc c#控制台点阵字输出 c#do while循环 c#调用dll多线程 c#找出两个集合不同的
立即提问