struts2+spring+mybatis 程序不报错,但是数据无法写入数据库

执行到service 无法写入数据库,不报错。代码如下:

 <?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="app.login.dao.UserDao">

    <resultMap type="app.login.domain.User" id="userResult">
        <result property="id" column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
        <result property="username" column="username" />
        <result property="password" column="password" />
    </resultMap>
    <select id="queryUserForLogin"  parameterType="user" resultMap="userResult">
        select * from user 
        where 
            username=#{username} and password=#{password}
    </select>

    <select id="selectAllUser" resultMap="userResult">
        select * from user
    </select>
 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <typeAliases>
        <typeAlias alias="user" type="app.login.domain.User"/>
        <typeAlias alias="sysLog" type="app.log.domain.SysLog"/>
    </typeAliases>
    <mappers>
        <mapper resource="app/login/domain/User.xml" />
        <mapper resource="app/log/domain/SysLog.xml" />
    </mappers>
</configuration>

ackage app.log.dao;

import java.util.List;

import app.log.domain.SysLog;

public interface ILogDao {
public abstract void insertLog(SysLog sysLog);

 ackage app.log.dao;

import java.util.List;

import app.log.domain.SysLog;



public interface ILogDao {
    public abstract void insertLog(SysLog sysLog);

    public abstract void updateLog(SysLog sysLog);

    public abstract void deleteLog(SysLog sysLog);

    public abstract List<SysLog> findAll();

}

 package app.log.service.impl;

import java.util.List;

import app.log.dao.ILogDao;
import app.log.domain.SysLog;
import app.log.service.ILogService;



public class LogService implements ILogService {
    private ILogDao logDao;

    @Override
    public void addLog(SysLog sysLog) {
        // TODO Auto-generated method stub
        System.out.println("addLog service.....");
        logDao.insertLog(sysLog);
        System.out.println("addLog service over.....");
    }

    @Override
    public void updateLog(SysLog sysLog) {
        // TODO Auto-generated method stub
        logDao.updateLog(sysLog);
    }

    @Override
    public void deleteLog(SysLog sysLog) {
        // TODO Auto-generated method stub
        logDao.deleteLog(sysLog);
    }

    @Override
    public List<SysLog> findAllUser() {
        // TODO Auto-generated method stub
        return logDao.findAll();
    }

    public ILogDao getLogDao() {
        return logDao;
    }

    public void setLogDao(ILogDao logDao) {
        this.logDao = logDao;
    }

}

 <?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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/aop 
           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx
           http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">



    <!-- 数据库配置文件位置 -->
    <context:property-placeholder location="classpath:jdbc.properties" />

    <!-- 配置dbcp数据源 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <!-- 队列中的最小等待数 -->
        <property name="minIdle" value="${jdbc.minIdle}"></property>
        <!-- 队列中的最大等待数 -->
        <property name="maxIdle" value="${jdbc.maxIdle}"></property>
        <!-- 最长等待时间,单位毫秒 -->
        <property name="maxWait" value="${jdbc.maxWait}"></property>
        <!-- 最大活跃数 -->
        <property name="maxActive" value="${jdbc.maxActive}"></property>
        <property name="initialSize" value="${jdbc.initialSize}"></property>
    </bean>

    <!-- 配置mybitasSqlSessionFactoryBean -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:mybatis.xml"></property>
    </bean>

    <bean id="userDao" class="org.mybatis.spring.mapper.MapperFactoryBean">  
        <property name="mapperInterface" value="app.login.dao.UserDao"/>  
        <property name="sqlSessionFactory" ref="sqlSessionFactory" />  
    </bean>  

      <bean id="userService" class=" app.login.service.impl.UserService">  
        <property name="userDao" ref="userDao"></property>  
    </bean> 

    <bean id="loginAction" class="app.login.action.LoginAction">  
        <property name="userService" ref="userService"></property>  
    </bean> 

        <bean id="logDao" class="org.mybatis.spring.mapper.MapperFactoryBean">  
        <property name="mapperInterface" value="app.log.dao.ILogDao"/>  
        <property name="sqlSessionFactory" ref="sqlSessionFactory" />  
    </bean>  

      <bean id="logService" class=" app.log.service.impl.LogService">  
        <property name="logDao" ref="logDao"></property>  
    </bean> 


</beans>

3个回答

首先,看看数据库中表user 是不是被锁了
使用Log4j,把mybaits执行过程 中的sql语句打印出来。然后放到MYsql中执行。。

没有flush到数据库吧

具体要怎么做?我是新手,求指教

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
struts2+spring+mybatis 程序不报错,但是数据无法写入数据库

执行到service 无法写入数据库,不报错。代码如下: ``` <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="app.login.dao.UserDao"> <resultMap type="app.login.domain.User" id="userResult"> <result property="id" column="id" jdbcType="INTEGER" javaType="java.lang.Integer" /> <result property="username" column="username" /> <result property="password" column="password" /> </resultMap> <select id="queryUserForLogin" parameterType="user" resultMap="userResult"> select * from user where username=#{username} and password=#{password} </select> <select id="selectAllUser" resultMap="userResult"> select * from user </select> ``` ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <typeAliases> <typeAlias alias="user" type="app.login.domain.User"/> <typeAlias alias="sysLog" type="app.log.domain.SysLog"/> </typeAliases> <mappers> <mapper resource="app/login/domain/User.xml" /> <mapper resource="app/log/domain/SysLog.xml" /> </mappers> </configuration> ``` ackage app.log.dao; import java.util.List; import app.log.domain.SysLog; public interface ILogDao { public abstract void insertLog(SysLog sysLog); ``` ackage app.log.dao; import java.util.List; import app.log.domain.SysLog; public interface ILogDao { public abstract void insertLog(SysLog sysLog); public abstract void updateLog(SysLog sysLog); public abstract void deleteLog(SysLog sysLog); public abstract List<SysLog> findAll(); } ``` ``` package app.log.service.impl; import java.util.List; import app.log.dao.ILogDao; import app.log.domain.SysLog; import app.log.service.ILogService; public class LogService implements ILogService { private ILogDao logDao; @Override public void addLog(SysLog sysLog) { // TODO Auto-generated method stub System.out.println("addLog service....."); logDao.insertLog(sysLog); System.out.println("addLog service over....."); } @Override public void updateLog(SysLog sysLog) { // TODO Auto-generated method stub logDao.updateLog(sysLog); } @Override public void deleteLog(SysLog sysLog) { // TODO Auto-generated method stub logDao.deleteLog(sysLog); } @Override public List<SysLog> findAllUser() { // TODO Auto-generated method stub return logDao.findAll(); } public ILogDao getLogDao() { return logDao; } public void setLogDao(ILogDao logDao) { this.logDao = logDao; } } ``` ``` <?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 数据库配置文件位置 --> <context:property-placeholder location="classpath:jdbc.properties" /> <!-- 配置dbcp数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!-- 队列中的最小等待数 --> <property name="minIdle" value="${jdbc.minIdle}"></property> <!-- 队列中的最大等待数 --> <property name="maxIdle" value="${jdbc.maxIdle}"></property> <!-- 最长等待时间,单位毫秒 --> <property name="maxWait" value="${jdbc.maxWait}"></property> <!-- 最大活跃数 --> <property name="maxActive" value="${jdbc.maxActive}"></property> <property name="initialSize" value="${jdbc.initialSize}"></property> </bean> <!-- 配置mybitasSqlSessionFactoryBean --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:mybatis.xml"></property> </bean> <bean id="userDao" class="org.mybatis.spring.mapper.MapperFactoryBean"> <property name="mapperInterface" value="app.login.dao.UserDao"/> <property name="sqlSessionFactory" ref="sqlSessionFactory" /> </bean> <bean id="userService" class=" app.login.service.impl.UserService"> <property name="userDao" ref="userDao"></property> </bean> <bean id="loginAction" class="app.login.action.LoginAction"> <property name="userService" ref="userService"></property> </bean> <bean id="logDao" class="org.mybatis.spring.mapper.MapperFactoryBean"> <property name="mapperInterface" value="app.log.dao.ILogDao"/> <property name="sqlSessionFactory" ref="sqlSessionFactory" /> </bean> <bean id="logService" class=" app.log.service.impl.LogService"> <property name="logDao" ref="logDao"></property> </bean> </beans> ``` ``` ```

struts+spring+mybatis运行报错

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ssf' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:677) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1939) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:914) at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:283) at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:357) at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2304) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2287) at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2038) at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533) at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseProductName(VendorDatabaseIdProvider.java:82) at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseName(VendorDatabaseIdProvider.java:66) at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseId(VendorDatabaseIdProvider.java:53) at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:395) at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:295) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562) ... 25 more

shiro 集成 spring struts mybatis 如何根据权限跳转前后台

shiro 集成 spring struts mybatis 如何根据权限跳转前后台

spring+springmvc+mybatis环境搭建报错

## # application.xml spring配置文件内容: <!-- 引入jdbc配置文件 --> <context:property-placeholder location="classpath:config/jdbc.properties" /> <!-- 可通过注解控制事务 <tx:annotation-driven />--> <!-- 扫描注解类,否则找不到bean --> <context:component-scan base-package="com.zj.service"></context:component-scan> ## # springmvc-servlet.xml 文件内容: <!-- 启用spring mvc 注解 <context:annotation-config />--> <!-- 设置使用注解的类所在的jar包 --> <context:component-scan base-package="com.zj.controller"></context:component-scan> <!--创建jdbc数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${driver}" /> <property name="url" value="${url}" /> <property name="username" value="${uname}" /> <property name="password" value="${pwd}" /> </bean> <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath:com/zj/dao/*.xml"></property> </bean> <!-- DAO接口所在包名,Spring会自动查找其下的类 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.zj.dao" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> </bean> <!-- 完成请求和注解POJO的映射 --> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <!-- 对转向页面的路径解析。prefix:前缀, suffix:后缀 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> ## # LoginController.java package com.zj.controller; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.zj.entity.UserInfo; import com.zj.service.LoginService; @Controller public class LoginController { private LoginService loginService; public LoginService getLoginService() { return loginService; } @Autowired public void setLoginService(LoginService loginService) { this.loginService = loginService; } @RequestMapping("/login") public ModelAndView login(String username,String password, HttpServletRequest request){ return new ModelAndView("login"); } @RequestMapping("/login2") public ModelAndView testLogin2(String username, String password){ UserInfo ui = new UserInfo(); UserInfo result = this.loginService.find(ui); System.out.println("用户名:"+result.getUsername()); // request和response不必非要出现在方法中,如果用不上的话可以去掉 // 参数的名称是与页面控件的name相匹配,参数类型会自动被转换 if (result==null) { return new ModelAndView("loginError"); // 手动实例化ModelAndView完成跳转页面(转发),效果等同于上面的方法返回字符串 }else{ return new ModelAndView("loginSuccess"); } // 采用重定向方式跳转页面 // 重定向还有一种简单写法 // return new ModelAndView("redirect:../index.jsp"); } } } ## # LoginDao.java package com.zj.dao; import com.zj.entity.UserInfo; public interface LoginDao { public UserInfo getUserInfo(UserInfo UserInfo); // public void addUserInfo(UserInfo UserInfo); // // public void updateUserInfo(UserInfo UserInfo); // // public void deleteUserInfo(int UserInfoId); } ## # LoginDao.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.zj.dao.LoginDao"> <select id="getUserInfo" parameterType="com.zj.entity.UserInfo" resultType="com.zj.entity.UserInfo"> SELECT * FROM userinfo WHERE username=#{username} AND password=#{password} </select> </mapper> # 业务实现类LoginServiceImpl.java package com.zj.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zj.dao.LoginDao; import com.zj.entity.UserInfo; import com.zj.service.LoginService; @Service("loginService") public class LoginServiceImpl implements LoginService{ private LoginDao loginDao; public LoginDao getUserDao() { return loginDao; } @Autowired public void setUserDao(LoginDao userDao) { this.loginDao = userDao; } public UserInfo find(UserInfo userInfo) { return this.loginDao.getUserInfo(userInfo); } } ## # web.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" 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>pro</display-name> <!-- 不拦截静态文件 --> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/js/*</url-pattern> <url-pattern>/css/*</url-pattern> <url-pattern>/imgs/*</url-pattern> <url-pattern>/fonts/*</url-pattern> </servlet-mapping> <!-- Spring配置 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:config/applicationContext.xml</param-value> </context-param> <!-- Spring MVC配置 --> <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:config/springmvc-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- 配置字符集 --> <filter> <filter-name>encodingFilter</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> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <session-config> <session-timeout>30</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> # 最后是错误信息: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.zj.dao.LoginDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 用测试类测试的时候没有问题,一启动tomcat就报错,求看看是哪里的问题,谢谢![![![图片说明](https://img-ask.csdn.net/upload/201512/22/1450795020_467185.png)图片说明](https://img-ask.csdn.net/upload/201512/22/1450795014_103343.png)图片说明](https://img-ask.csdn.net/upload/201512/22/1450794997_116981.png)

struts spring mybatis 整合出问题

报错: IOException parsing XML document from ServletContext resource [/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml] 配置文件applicationContext.xml </beans> <!-- 数据库连接池 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/test" /> <property name="user" value="root" /> <property name="password" value="admin" /> <property name="initialPoolSize" value="10" /> <property name="minPoolSize" value="5" /> <property name="maxPoolSize" value="30" /> <property name="acquireIncrement" value="10" /> <property name="maxIdleTime" value="10" /> <property name="maxStatements" value="0" /> </bean> <!-- 使用spring的会话管理 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="c3p0dataSource" /> <property name="configLocation" value="classpath:Configuration.xml" /> </bean> <!-- 使用spring的事务管理 --> <bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean>

spring + mybatis + struts2配置扫描器报错

![图片说明](https://img-ask.csdn.net/upload/201704/09/1491730658_331460.png)

spring3+mybatis 注入空指针问题,请各位帮忙一下。

大家好,我刚学习三大框架,碰到一个空指针问题怎么都解决不了,快3天了,请帮忙下,谢谢了。 我测试所有的注入都是空指针 applicationContext.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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jdbc=" http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd" default-autowire="byName" default-lazy-init="false"> <!-- 开启自动扫描并注册Bean定义支持 --> <!-- <context:component-scan base-package="cn.xhf"></context:component-scan> --> <!-- 采用注释的方式配置bean --> <!-- <context:annotation-config /> --> <!-- 配置datasource源 --> <context:property-placeholder location="classpath:mysql.properties" /> <!-- 使用mysql配置属性值 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${driver}" /> <property name="url" value="${url}" /> <property name="username" value="${username}" /> <property name="password" value="${password}" /> <property name="maxActive" value="${maxActive}"></property> <property name="maxIdle" value="${maxIdle}"></property> <property name="maxWait" value="${maxWait}"></property> <property name="defaultAutoCommit" value="${defaultAutoCommit}"></property> </bean> <!-- 配置sqlSessionFactory,同时制定数据源 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:Configuration.xml" /> </bean> <!-- 配置SqlSessionTemplate --> <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg index="0" ref="sqlSessionFactory" /> <constructor-arg index="1" value="BATCH" /> </bean> <!-- 配置dao --> <bean id="booksDao" class="cn.xhf.dao.impl.BooksDaoImpl"> <property name="sqlSession" ref="sqlSession"></property> </bean> <bean id="usersDao" class="cn.xhf.dao.impl.UsersDaoImpl"> <property name="sqlSession" ref="sqlSession"></property> </bean> <!-- 配置service --> <bean id="booksService" class="cn.xhf.service.impl.BooksServiceImpl" scope="prototype"> <property name="booksDao" ref="booksDao"></property> </bean> <bean id="usersService" class="cn.xhf.service.impl.UsersServiceImpl" scope="prototype"> <property name="usersDao" ref="usersDao"></property> </bean> <!-- 配置action --> <bean id="booksAction" class="cn.xhf.action.BooksAction" scope="prototype"> <property name="booksService" ref="booksService"></property> </bean> <bean id="usersAction" class="cn.xhf.action.UsersAction" scope="prototype"> <property name="usersService" ref="usersService"></property> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- 通知 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="find*" read-only="true" /> <tx:method name="get*" read-only="true" /> <tx:method name="select*" read-only="true" /> </tx:attributes> </tx:advice> <!-- 切面配置 --> <!-- <aop:config> <aop:pointcut expression="execution(* cn.xhf.service.*.*(..))" id="method" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="method" /> </aop:config> --> </beans> ``` dao层 ``` package cn.xhf.dao.impl; import java.util.ArrayList; import java.util.List; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import cn.xhf.dao.BooksDao; import cn.xhf.pojo.Books; /** * */ public class BooksDaoImpl implements BooksDao { private SqlSession sqlSession; //就是这个空指针 ,其他bean也是空 @Override public int deleteBooksById(String bid) { return sqlSession.delete("books.deleteBooksById", bid); } @Override public int updataBooksById(String bid) { return sqlSession.update("books.updataBooksById", bid); } @Override public List<Books> findAll() { List<Books> booksList = new ArrayList<Books>(); booksList = sqlSession.selectList("books.findBooks"); return booksList; } @Override public List<Books> findBooksByKeyword(String bookName, String bookAuthor) { List<Books> bookList = new ArrayList<Books>(); // Books books = new Books(); // books.setBookName(bookName); // books.setBookAuthor(bookAuthor); // bookList = sqlSession.selectList("books.findBooks", books); return bookList; } @Override public int insertBooks(Books books) { return sqlSession.insert("books.insertBooks", books); } public SqlSession getSqlSession() { return sqlSession; } public void setSqlSession(SqlSession sqlSession) { this.sqlSession = sqlSession; } } ``` test方法 ``` package cn.xhf.pojo; import java.util.List; import cn.xhf.dao.BooksDao; import cn.xhf.dao.impl.BooksDaoImpl; public class TestBooks { public static void main(String[] args) { BooksDao booksDao = new BooksDaoImpl(); List<Books> list = booksDao.findAll(); System.out.println(list.size()); } } ``` 报错信息: Exception in thread "main" java.lang.NullPointerException at cn.xhf.dao.impl.BooksDaoImpl.findAll(BooksDaoImpl.java:32) at cn.xhf.pojo.TestBooks.main(TestBooks.java:11)

struts2+spring+mybatis框架。 进入一个页面时,同时访问三个url会报错。

![图片说明](https://img-ask.csdn.net/upload/201603/11/1457674705_105173.png)![图片说明](https://img-ask.csdn.net/upload/201603/11/1457674720_243300.png)![图片说明](https://img-ask.csdn.net/upload/201603/11/1457674732_789202.png)

用ssm框架做联表查询,报出PersistenceException异常,求助如何解决

用ssm框架做联表查询,报出PersistenceException异常,求助如何解决 这是一个对Student和Classes两张表的联表查询,查所有学生信息,包括他们的班级名称。 表的关系很简单,c表的主键id与s表classid列的外键关联。Student类中有Classes cla属性。 以下是mapperxml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.bdqn.dao.StuDao"> <resultMap type="Student" id="stuResultMap"> <id column="id" javaType="java.lang.Integer" property="sid"/> <result column="name" property="sname"/> <result column="telephone" property="telephone"/> <result column="email" property="email"/> <result column="age" property="age"/> <association property="cla" javaType="Classes"> <result column="id" property="cid"/> <result column="name" property="cname"/> </association> </resultMap> <select id="selectAllStu" resultType="Student"> select s.id sid, s.name sname, s.telephone telephone, s.email email,s.age age,c.name cname ,c.id cid from student s left join classes c on s.classid=c.id </select> </mapper> ``` 一下是执行action时候的报错信息。页面报错,后台不报错。 ``` exception org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.NullPointerException ### The error may exist in mappers/StuDaoMapper.xml ### The error may involve cn.bdqn.dao.StuDao.selectAllStu ### The error occurred while executing a query ### Cause: java.lang.NullPointerException org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364) com.sun.proxy.$Proxy9.selectList(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:194) org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) com.sun.proxy.$Proxy10.selectAllStu(Unknown Source) cn.bdqn.service.impl.StuServiceImpl.selectAllStu(StuServiceImpl.java:21) cn.bdqn.action.StuAction.toStuList(StuAction.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) ``` 以前做过极为类似的联表查询,没出现过这个异常,鼓捣一会儿还不行,求助各位!

仅仅只用mybatis框架操作数据库 设置懒加载后报错:创建延时代理出错,空指针异常

如果不设置懒加载,数据能读出来, 设置懒加载后,报错 Cause: org.apache.ibatis.executor.ExecutorException: Error creating lazy proxy. Cause: java.lang.NullPointerException mybatis版本3.46 配置文件 Order <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gyf.mapper.OrderMapper"> <!-- ============= 懒加载 ==================--> <resultMap id="orderLazyloadingRslMap" type="orders"> <id column="id" property="id"/> <id column="user_id" property="user_id"></id> <result column="note" property="note"/> <result column="number" property="number"/> <result column="createtime" property="createtime"/> <!--配置查询--> <association property="user" javaType="com.gyf.model.User" select="com.gyf.mapper.UserMapper.findUserById" column="user_id"/> </resultMap> <select id="findOrderAndUserByLazyloading" resultMap="orderLazyloadingRslMap"> SELECT * FROM orders </select> </mapper> 配置文件 User <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gyf.mapper.UserMapper"> <select id="findUserById" parameterType="int" resultType="user"> SELECT * FROM user WHERE id = #{id} </select> </mapper> sqlMapConfig: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <properties resource="db.properties"/> <!--配置允许懒加载--> <settings> <setting name="lazyLoadingEnabled" value="true"/> </settings> <!--配置别名--> <typeAliases> <!--指定包名,别名就是类名,第一个小写 User 别名就是user--> <package name="com.gyf.model"></package> <package name="com.gyf.vo"></package> </typeAliases> <!-- 配置mybatis的环境信息 --> <environments default="development"> <environment id="development"> <!-- 配置JDBC事务控制,由mybatis进行管理 --> <transactionManager type="JDBC"></transactionManager> <!-- 配置数据源,采用dbcp连接池 --> <dataSource type="POOLED"> <property name="driver" value="${driverClass}"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </dataSource> </environment> </environments> <!--mybatis加载映射文件--> <mappers> <package name="com.gyf.mapper"></package> </mappers> </configuration> 模型: public class Orders { private Integer id; private Integer user_id; private String note;//备注 private String number; private Date createtime;//写意的创建时间 private User user;//定单所属的用户 public User getUser() { return user; } public void setUser(User user) { this.user = user; } ....get 和 set 方法 } public class User implements Serializable { private int id; private String username;// 用户姓名 private String sex;// 性别 private Date birthday;// 生日 private String address;// 地址 ....get 和 set 方法 } 测试 public class Demo01 { SqlSession session; @Before public void before() throws IOException { System.out.println("before.....获取session"); // a)读取配置文件; InputStream is = Resources.getResourceAsStream("SqlMapConfig.xml"); //b)通过SqlSessionFactoryBuilder创建SqlSessionFactory会话工厂。 SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(is); session = sessionFactory.openSession(); } @After public void after(){ session.close(); } /** * 懒加载 * @throws IOException */ @Test public void test10() throws IOException { OrderMapper mapper = session.getMapper(OrderMapper.class); List<Orders> list = mapper.findOrderAndUserByLazyloading(); for (Orders order : list){ System.out.println("订单信息:"); System.out.println(order); System.out.println("订单所属的客户:"); System.out.println(order.getUser()); } } }

框架mybatis+spring+struts2

getSqlSession().selectList("api.getReadFAQ"); getSqlSession().selectList("api.getReadFAQ"); 有时候突然在执行到这句代码的时候就卡主了 也不报错, 跪求原因,谢谢各位大神了,但是同样的语句 ,在别的主机上就可以执行,奇怪的很,为我是集群了2个tomcat,其中一台就好着,就这台每天偶尔都胡出现这个问题,愁死我了

springmvc+mybatis整合maven项目跳转页面404问题

controller package com.cn.hnust.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.cn.hnust.pojo.User; import com.cn.hnust.service.IUserService; @Controller @RequestMapping("/user") public class UserController { @Resource private IUserService userService; @RequestMapping("/showUser") public String toIndex(HttpServletRequest request,Model model){ int userId = Integer.parseInt(request.getParameter("id")); User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "showUser"; } } web.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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>Archetype Created Web Application</display-name> <!-- Spring和mybatis的配置文件 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-mybatis.xml</param-value> </context-param> <!-- 编码过滤器 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <async-supported>true</async-supported> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- Spring监听器 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 防止Spring内存溢出监听器 --> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <!-- Spring MVC servlet --> <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> <async-supported>true</async-supported> </servlet> <servlet-mapping> <servlet-name>SpringMVC</servlet-name> <!-- 此处可以可以配置成*.do,对应struts的后缀习惯 --> <url-pattern>/</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>/index.jsp</welcome-file> </welcome-file-list> <!-- 配置SESSION超时,单位是分钟 --> <session-config> <session-timeout>15</session-timeout> </session-config> </web-app> springmvc-mybatis <?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:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="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 http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <!-- 自动扫描 --> <context:component-scan base-package="com.cn.hnust" /> <!-- 引入配置文件 --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:jdbc.properties" /> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${driver}" /> <property name="url" value="${url}" /> <property name="username" value="${username}" /> <property name="password" value="${password}" /> <!-- 初始化连接大小 --> <property name="initialSize" value="${initialSize}"></property> <!-- 连接池最大数量 --> <property name="maxActive" value="${maxActive}"></property> <!-- 连接池最大空闲 --> <property name="maxIdle" value="${maxIdle}"></property> <!-- 连接池最小空闲 --> <property name="minIdle" value="${minIdle}"></property> <!-- 获取连接最大等待时间 --> <property name="maxWait" value="${maxWait}"></property> </bean> <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath:com/cn/hnust/mapping/*.xml"></property> </bean> <!-- DAO接口所在包名,Spring会自动查找其下的类 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.cn.hnust.dao" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> </bean> <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> </beans> 大神们帮忙看看哪里出错了,谢谢

严重: Exception starting filter struts2

![架包](https://img-ask.csdn.net/upload/201709/15/1505455599_410303.jpg)![架包](https://img-ask.csdn.net/upload/201709/15/1505455700_768683.jpg) # web.xml : ![图片说明](https://img-ask.csdn.net/upload/201709/15/1505456379_192500.jpg) ![图片说明](https://img-ask.csdn.net/upload/201709/15/1505456392_583121.jpg) # struts.xml: ![图片说明](https://img-ask.csdn.net/upload/201709/15/1505456426_93777.jpg) # Spring-mybatis.xml: ![图片说明](https://img-ask.csdn.net/upload/201709/15/1505456521_361564.jpg) ![图片说明](https://img-ask.csdn.net/upload/201709/15/1505456538_421226.jpg) 严重: Exception starting filter struts2 Unable to load configuration. - bean - jar:file:/D:/Program/ApacheSoftwareFoundation/Tomcat7.0/webapps/stt/WEB-INF/lib/struts2-core-2.3.24.jar!/struts-default.xml:90:87 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:493) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: Unable to load configuration. - bean - jar:file:/D:/Program/ApacheSoftwareFoundation/Tomcat7.0/webapps/stt/WEB-INF/lib/struts2-core-2.3.24.jar!/struts-default.xml:90:87 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479) ... 17 more 第一次使用Struts2+Spring+mybatis框架,启动Tomcat 7.0时一直报错,求大神指点

mybatis是怎么找到sqlmapconfig.xml的

学hibernate的时候,config文件名是固定的 mybatis老师说可以随便取,那mybatis是怎么知道这个xml文件就是我们需要的sqlmapconfig.xml呢

mybatis 加了@param注解 还是遇到there is no getter异常

mybatis 加了@param注解 还是遇到there is no getter异常 看了网上说的大都是因为没有加@param注解,但是我加了还是报这个错误

mybatis session.selectOne(key,value)问题

各位大神们,mybatis session.selectOne(key,value)调用xml的sql语句无返回值,怎么回事? 情况是这样的,今天领导给我一个完成的项目代码,是用spring,struts,mybatis编写的java项目,让我把里面连接的sqlserver数据库改为连接mysql,改完连接的驱动,用户名,密码之后,运行发现连接不上,数据库没问题,看完各种逻辑代码之后,发现是使用到了session.selectOne()方法时无法从数据库查询到的数据返回,不知什么原因,这问题困扰了我一整天,实在没办法,请各位有相关经验的高手指点指点,本人之前没接触过mybatis,请各位帮我解答,小弟万分感谢!!!!

mybatis 如何用update修改关联表Service业务层怎么实现

## /**软件环境**/ 框架:spring springMVC mybatis 数据库:mysql ## /**报错信息**/ ![图片说明](https://img-ask.csdn.net/upload/201903/04/1551665050_386888.png) ## /**代码提示**/ //数据层mybatis xml文件 ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.app.dao.mapper.MemberPermissionMapper"> <resultMap type="MemberPermission" id="MemberPermission"> <id column="id" property="id"/> <result column="member_id" property="member_id"/> <result column="ttys" property="ttys"/> <result column="key" property="key"/> <result column="lose_time" property="lose_time"/> <result column="note" property="note"/> <result column="update_time" property="update_time"/> <!-- 关联member表 --> <association property="member" javaType="com.app.bean.Member"> <id column="member_id" property="id"/> <result column="phone" property="phone"/> <result column="name" property="name"/> <result column="password" property="password"/> </association> </resultMap> <update id="updateMemberLoginPermission" parameterType="map"> UPDATE dt_member_permission AS t1 LEFT JOIN dt_member AS t2 ON t1.member_id=t2.id <set> <if test="key!=null and key !=''">t1.key=#{key}, </if> </set> WHERE t1.ttys=#{key} AND t2.phone=#{phone} AND t2.password=#{password} </update> ``` //service业务层接口实现类提示 phone和newpwd字段是在关联表member里面 ``` @Override public int updateMemberLoginPermission( String ttys, String phone, String newpwd, String key_dm) { MemberPermission memberPermission= new MemberPermission(); memberPermission.setTtys(ttys); memberPermission.setKey_dm(key_dm); Member member = new Member(); member.setPhone(phone); member.setPassword(newpwd); return memberPermissionDao.updateMemberLoginPermission(memberPermission,member); } ``` //javabean实体类提示 ``` package com.app.bean; import java.util.Date; /** * 用户权限组合表 * pjc * 2019.2.25 */ public class MemberPermission { private int id; private int member_id; private String ttys;//终端类型 private String key; private Date lose_time; private String note; private Date update_time; public MemberPermission() { } public MemberPermission(int id, int member_id, String ttys, String key, Date lose_time, String note, Date update_time) { this.id = id; this.member_id = member_id; this.ttys = ttys; this.key = key; this.lose_time = lose_time; this.note = note; this.update_time = update_time; } public int getId() { return id; } /**后面省略** ``` //关联表Javabean提示 ``` public class Member { private int id; private String name; private String password; private int gender; private Date birthday; private String phone; private String email; private Date regtime; private Date losetime; private Date losetime_jl; private Date losetime_tz; private Date losetime_bj; private Date losetime_sz; private String nickname; private String head; private int status; private int type; private String note; private String departments; private String hospital; private String province; private String city; private String country; private String key;//用户授权码实现单点登录 private String key_jl;//实现经络app单点登录 private String key_tz;//实现体质app单点登录 private String key_bj;//实现保健机构用户单点登录 private String key_sz;//实现手诊用户单点登录 private Date record_time; private String advice;//医师建议 ``` //mapper.java文件提示 ![图片说明](https://img-ask.csdn.net/upload/201903/04/1551686590_996340.png) ## /**尝试过的办法1: key字段已经统一改为key_dm和数据库实体类全部统一 去掉@param注解 修改mybatis.xml**/ //dao层接口代码提示 mapper.java文件 ``` public interface MemberPermissionMapper { public int updateMemberLoginPermission(MemberPermission memberPermission,Member member);//根据终端类型 用户手机号密码修改动态key 关联表 } ``` //service层接口提示 ``` package com.app.service; import java.util.Date; import java.util.List; import java.util.Map; import com.app.bean.Member; public interface MemberService { public int updateMemberLoginPermission(String ttys,String phone, String newpwd, String key_dm); } ``` //service层接口实现类提示 ``` @Override public int updateMemberLoginPermission( String ttys, String phone, String newpwd, String key_dm) { MemberPermission memberPermission= new MemberPermission(); memberPermission.setTtys(ttys); memberPermission.setKey_dm(key_dm); Member member = new Member(); member.setPhone(phone); member.setPassword(newpwd); return memberPermissionDao.updateMemberLoginPermission(memberPermission,member); } ``` //mybatis.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.app.dao.mapper.MemberPermissionMapper"> <resultMap type="com.app.bean.MemberPermission" id="MemberPermission"> <id column="id" property="id"/> <result column="member_id" property="member_id"/> <result column="ttys" property="ttys"/> <result column="key_dm" property="key_dm"/> <result column="lose_time" property="lose_time"/> <result column="note" property="note"/> <result column="update_time" property="update_time"/> <!-- 关联member表 --> <association property="member" javaType="com.app.bean.Member"> <id column="member_id" property="id"/> <result column="phone" property="phone"/> <result column="name" property="name"/> <result column="password" property="password"/> </association> </resultMap> <update id="updateMemberLoginPermission" parameterType="com.app.bean.Member"> UPDATE dt_member_permission AS t1 LEFT JOIN dt_member AS t2 ON t1.member_id=t2.id <set> <if test="key_dm!=null and key_dm !=''">t1.key_dm=#{key_dm}, </if> </set> WHERE t1.ttys=#{ttys} AND t2.phone=#{phone} AND t2.password=#{password} </update> ``` //报错提示 ![图片说明](https://img-ask.csdn.net/upload/201903/05/1551755075_567480.png) ## /**尝试方法2 已解决: 关联对象传参问题**/ 别用实体类传参,使用map。 Map map = new HashMap(); map.put("ttys",ttys); map.put("phone",phone); map.put("key_dm",key_dm); map.put("password",password); xml中的update语句修改成: UPDATE dt_member_permission AS t1 LEFT JOIN dt_member AS t2 ON t1.member_id=t2.id t1.key_dm=#{key_dm} WHERE t1.ttys=#{ttys} AND t2.phone=#{phone} AND t2.password=#{password}

spring配置set注入时,properties中的name只能使用先前配置过的bean的id。

``` <bean id="EmployeeAction" scope="prototype" class="com.tw.web.action.EmployeeAction"> <property name="employeeDao" ref="employeeDao"/> <property name="baseDao" ref="employeeDao"/> <property name="dao" ref="employeeDao"/> </bean> ``` 以上三种情况: 第一种(employeeDao):可以正确注入 第二种(baseDao):由于配置中有一个id="baseDao"的抽象bean,所以会报错:baseDao这bean是一个抽象bean。 第三种(dao):根本不进入set中。 先前我一直纳闷为什么name和ref的字符串不一样就不能够正确注入。直到看到第二种配置报的错,才发现name直接就对应了配置中bean的id了。 是这样的: 我的配置中确实存在一个id="baseDao"的抽象类 但是在注入时,baseDao只是一个属性。相当于: public void setBaseDao(IEmployeeDao employeeDao){} 我的配置是: ``` <property name="baseDao", ref="employeeDao" /> ``` 那么Spring按理应该是通过ref去找id="employeeDao"的bean然后注入到setBaseDao中。 但是我遇到的问题是,Spring是通过name去找id="baseDao"的bean。 另外, ``` <property name="id", value="1" /> ``` 这样的形式也不行。 奇怪的是,配置SessionFactory的时候并没有问题。 **刚刚在相关提问中找到一个解决方法:把Struts配置中的class="类全限定名",改成Spring配置的bean的id就行了。还是想请问一下有谁知道是什么问题吗?** 谢谢各位!

用cos文件上传报错.......

java.io.IOException: Corrupt form data: premature ending 好像是很古老的东西了,cos从2002就没更新了。。。查到的都是说是跟struts冲突了 自动拦截了request还是什么的..spring boot mybatis 也遇到这种情况。。弄不清到底 是哪里冲突了。。。

Spring框架使用setter方式依赖注入bean当bean和被注入的bean放在同一个包下面会警告Cannot access 该类?

``` @Service(value = "pojo") public class POJO { private Dependency dependency; @Autowired public void setDependencya(Dependency dependency) { this.dependency = dependency; } void execute(){ dependency.a(); } } class Test { public static void main(String[] args) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("springmvc.xml"); POJO pojo = (POJO) applicationContext.getBean("pojo"); pojo.execute(); } } ``` ``` @Component public class Dependency { public void a(){ System.out.println("dependencyA"); } } ``` ![图片说明](https://img-ask.csdn.net/upload/201909/28/1569640045_473267.png) 问题是当我的Dependency类放在另外一个包下面是完全正常的,两种方式都能正常注入,打印出dependencyA![图片说明](https://img-ask.csdn.net/upload/201909/28/1569640243_523017.png)

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

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

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

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

立即提问
相关内容推荐