sqlsessionfactory、sqlsession的作用,和Mybatis的关系?

学了spring,sqlsessionfactory、sqlsession好像是用来crud的,后来学了mybatis,就有dao接口和mapper.xml用来操作crud。是不是说Mybatis代替的就是spring的sqlsessionfactory、sqlsession的功能?

2个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
mybatis的sqlsession的作用是什么啊

mybatis的sqlsession的作用是什么啊?感觉用不到啊。。。。数据库增删改查 都是getxxx(),然后跳到xml的sql语句,都没用到sqlsessin啊~~

spring+mybatis,如何在程序中获得当前sqlsessionfactory

spring+mybatis,如何在程序中获得当前sqlsessionfactory

mybaits 小小白 error building sqlsession

org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 78; 根元素类型 "configuration" 的文档类型声明必须以 '>' 结尾。 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64) at com.atguigu.mybatis.test.MyBatisTest.test(MyBatisTest.java:19) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206) Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 78; 根元素类型 "configuration" 的文档类型声明必须以 '>' 结尾。 at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:259) at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:125) at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:81) at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:77) ... 25 more Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 78; 根元素类型 "configuration" 的文档类型声明必须以 '>' 结尾。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.scanDoctypeDecl(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:257) ... 28 more <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper SYSTEM "http://mybatis.org/dtd/mybatis-3-mapper.dtd" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"> -<mapper namespace="com.atguigu.mybatis.dao.EmployeeMapper"> <select resultType="com.atguigu.mybatis.bean.Employee" id="getEmpById">select id,last_name,email,gender from tbl_employee where id = #{id} </select> </mapper> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper SYSTEM "http://mybatis.org/dtd/mybatis-3-mapper.dtd" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"> -<mapper namespace="com.atguigu.mybatis.dao.EmployeeMapper"> <select resultType="com.atguigu.mybatis.bean.Employee" id="getEmpById">select id,last_name,email,gender from tbl_employee where id = #{id} </select> </mapper> ``` ``` package com.atguigu.mybatis.test; import java.io.IOException; import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.junit.Test; import com.atguigu.mybatis.bean.Employee; public class MyBatisTest { @Test public void test() throws IOException { String resource = "mybatis-config.xml"; InputStream inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); SqlSession openSession = sqlSessionFactory.openSession(); try { Employee employee = openSession.selectOne("EmployeeMapper", 1); System.out.println(employee); }finally { openSession.close(); } } }

mybatis整合spring,DAO从spring中拿sqlSessionFactory会失败

已经解决问题了。是这个代码编写错了。。。。。。。。。。。。。。。。

springboot+mybatis还需要配置SqlSessionFactory吗?

用idea第一次接触springboot+mybatis+mysql的新小白,还望大神回复: springboot+mybatis还需要向ssm框架那样配置SqlSessionFactory吗? 最好能把配置给我,谢谢

使用mybatis得不到SqlSessionFactory,哪位大神帮帮忙?

我在网上查过了,大家都是得不到sqlsession,我直接factory都得不到 这是配置文件 ``` <?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> <environments default="development">         <environment id="development">         <transactionManager type="JDBC"/>             <dataSource type="POOLED">             <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>             <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"/>             <property name="username" value="luoyang"/>             <property name="password" value="java"/>             </dataSource>         </environment>     </environments>         <mappers>         <mapper resource="com/mapper/StudentMapper.xml"/> </configuration> ``` ``` <?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.mapper.IStudentDao"> <resultMap type="com.bean.Student" id="rst_stu"> <id column="sid" property="sid"/> <result column="sname" property="sname"/> <result column="sex" property="sex"/> <result column="address" property="address"/> <result column="birthday" property="birthday"/> <result column="cid" property="cid"/> </resultMap> <insert id="save" parameterType="com.bean.Student"> insert into student values (seq_sid.nextval,#{sname},#{sex},#{address},#{birthday},#{cid}) </insert> <update id="update" parameterType="com.bean.Student"> update student set sname=#{sname},sex=#{sex},address=#{address},birthday=#{birthday},cid=#{cid} where sid=#{sid} </update> <delete id="delById" parameterType="int"> delete student set where sid=#{sid} </update> <select id="findById" parameterType="int" resultType="com.bean.Student"> select * from student where sid=#{sid} </select> <select id="findAll" resultType="com.bean.Student"> select * from student where 1=1 order by sid </select> <select id="doinit" resultType="com.bean.Clazz"> select * from clazz where 1=1 order by cid </select> </mapper> ``` ``` package com.test; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Date; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import com.bean.*; import com.mapper.*; public class StudentTest { public static void main(String[] args) { SqlSessionFactory sessionFactory=null; SqlSession session = null; //获取sqlsessionfactory 对象 try { InputStream is=Resources.getResourceAsStream("mybaties.xml"); System.out.println(is.available()); sessionFactory=new SqlSessionFactoryBuilder().build(is); System.out.println(sessionFactory); //获取sqlsession对象 session=sessionFactory.openSession(); Student st=new Student("高原", "男","运城",new Date(),1); int row=session.insert("com.mapper.IStudentDao.save", st); if(row>0){ session.commit(); System.out.println("保存成功"); }else{ System.out.println("保存失败"); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ session.close(); } } } ``` ![](https://img-ask.csdn.net/upload/201810/30/1540830163_828937.png)

mybatis调用过程中的SqlSessionFactory

初学框架,请教各位大佬,SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 创建SqlSessionFactory实例中,SqlSesssionFactoryBuilder().build(inputStream)看了下源码,返回值是new DefaultSqlSessionFactory(config)吧,此处不是已经new出了该类对象吗,然后创建实例中又new该值,不就是 (new new DefaultSqlSessionFactory(config))这样,可以new一个已经创建了的对象吗

spring和mybatis整合的,运行测试代码初始化sqlSessionFactory失败

整合spring和mybatis之后,测试整合是否成功的测试代码,抛出了异常。 以下是spring配置文件: ``` <?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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver"></property> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/***"></property> <property name="user" value="***"></property> <property name="password" value="***"></property> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="configLocation" value="sqlMapConfig.xml"></property> <property name="dataSource" ref="dataSource"></property> </bean> <!--<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="mapper1"></property> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> </bean> --> <bean id="userMapper" class="org.mybatis.spring.mapper.MapperFactoryBean"> <property name="mapperInterface" value="mapper1.UserMapper"></property> <property name="sqlSessionFactory" ref="sqlSessionFactory"></property> </bean> </beans> ``` mybatis主配置文件: ``` <?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> <mappers> <mapper resource="mapper1/UserMapper.xml"></mapper> </mappers> </configuration> ``` 测试代码: ``` package maintest1; import org.springframework.context.support.ClassPathXmlApplicationContext; import bean1.User1; import mapper1.UserMapper; public class Test1 { /** * @param args */ public static void main(String[] args) { UserMapper userMapper = (UserMapper)new ClassPathXmlApplicationContext("applicationConfig.xml").getBean("userMapper"); User1 user = userMapper.findById(1); System.out.println(user); } } ``` 运行后抛出的异常: ``` 12:30:57,314 INFO ClassPathXmlApplicationContext:578 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@68f99ff5: startup date [Fri Jun 28 12:30:57 GMT+08:00 2019]; root of context hierarchy 12:30:57,361 INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [applicationConfig.xml] 12:30:57,562 INFO MLog:212 - MLog clients using slf4j logging. 12:30:57,710 INFO C3P0Registry:212 - Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10] 12:30:57,935 WARN ClassPathXmlApplicationContext:546 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationConfig.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [sqlMapConfig.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationConfig.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [sqlMapConfig.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at maintest1.Test1.main(Test1.java:15) Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [sqlMapConfig.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:500) at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 12 more Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:109) at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92) at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:494) ... 15 more Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120) at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92) at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322) at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107) ... 17 more Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:103) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:264) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:251) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:243) at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116) ... 20 more Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'test1.User1'. Cause: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:117) at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:130) at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:101) ... 24 more Caused by: java.lang.ClassNotFoundException: Cannot find class: test1.User1 at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:190) at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89) at org.apache.ibatis.io.Resources.classForName(Resources.java:256) at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:113) ... 26 more ``` 看上面异常信息是"sqlSessionFactory"创建不出来,觉得问题原因应该是spring配置文件写错,但是检查了几次没有出现问题,请指教。 附上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> <mappers> <mapper resource="mapper1/UserMapper.xml"></mapper> </mappers> </configuration> ```

使用mybatis时sqlsession总是空指针异常

我的xml配置文件如下: ``` <?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="mysql.properties"/> <settings> <setting name="logImpl" value="LOG4J"></setting> </settings> <typeAliases> <typeAlias alias="User" type="ssm.pojo.User" /> </typeAliases> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="POOLED"> <property name="driver" value="${driver}"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </dataSource> </environment> </environments> <mappers> <mapper resource="ssm/dao/UserMapper.xml"/> </mappers> </configuration> ``` 获取session代码如下: ``` public class Test { private static SqlSessionFactory sf; static{ try { InputStream inputStream=Resources.getResourceAsStream("mybatis-config.xml"); sf= new SqlSessionFactoryBuilder().build(inputStream); } catch (Exception e) { // TODO: handle exception } } @org.junit.Test public void test() { SqlSession session=sf.openSession(false); List<User> list=session.selectList("ssm.dao.UserMapper.selectAll"); for (User user : list) { System.out.println(user.getUserName()); } } } ```

Maven工程中,无法创建Mybatis 的SessionFactory.

本人新人学习中,遇到了一个问题,望各位高手,前辈能指点一下,万分感谢. 功能实现: 前端页面输入内容后传到servlet,之后存入数据库. 问题: 前端数据已经能成功传到servlet. 在实现从servlet存到数据库的过程中,出现问题. 控制台提示为"类无法加载"异常. 经调试和检查后发现是卡在了输入流的代码,无法根据mybatis的配置文件的路径生成输入流对象,进而无法生成SqlSessionFactory对象. ``` package com.erp.utils; import java.io.IOException; import java.io.InputStream; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; public class FactoryMaker { public static SqlSessionFactory makeSqlSessionFactory() throws IOException { String resource = "MybatisConfig.xml"; InputStream inputStream = Resources.getResourceAsStream(resource); //bug调试时,在这条代码卡住了,之后报错. SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); return sqlSessionFactory; } } ``` 附上我的文件路径图,和控制台错误信息 ![图片说明](https://img-ask.csdn.net/upload/201909/13/1568370085_399320.png) ![图片说明](https://img-ask.csdn.net/upload/201909/13/1568370222_742428.png)

关于springMVC与Mybatis整合时对sqlSessionFactory和init的问题

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\workplace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SpringMVC-mybatis\WEB-INF\classes\com\crud\mapper\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userResultMap'. Cause: java.lang.ClassNotFoundException: Cannot find class: userResultMap

SqlSessionTemplate 与 SqlSessionFactory 使用时机是?

SqlSessionTemplate 与 SqlSessionFactory 使用时机是? 感觉两个都可以啊,SqlSessionFactory和SqlSessionFactory都是线程安全,那么在spring注入时应该优先选择哪个呢?有没大神解释一下?

spring + mybatis 事物不起作用,无法回滚

spring + mybatis 事物不起作用,无法回滚:求解 设置如下: <!-- proxy-target-class默认"false",更改为"ture"使用CGLib动态代理 --> <aop:aspectj-autoproxy proxy-target-class="true" /> <!-- 基于Druid数据库链接池的数据源配置 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="initialSize" value="${pool.initialSize}" /> <property name="minIdle" value="${pool.minIdle}" /> <property name="maxActive" value="${pool.maxActive}" /> <property name="maxWait" value="${pool.maxWait}" /> <property name="timeBetweenEvictionRunsMillis" value="${pool.timeBetweenEvictionRunsMillis}" /> <property name="minEvictableIdleTimeMillis" value="${pool.minEvictableIdleTimeMillis}" /> <property name="testWhileIdle" value="true" /> <property name="testOnBorrow" value="true" /> <property name="testOnReturn" value="false" /> <property name="validationQuery" value="${jdbc.validationQuery}" /> <property name="filters" value="config" /> <property name="connectionProperties" value="config.decrypt=true;config.decrypt.key=${jdbc.publickey}" /> </bean> <!-- 将数据源映射到sqlSessionFactory中 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath*:mapper/*.Mapper.xml" /> <property name="configLocation" value="classpath:config/mybatis-config.xml" /> </bean> <!-- SqlSession模板类实例 --> <bean id="sessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" destroy-method="close"> <constructor-arg index="0" ref="sqlSessionFactory" /> </bean> <!--======= 事务配置 Begin ================= --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- <aop:pointcut id="txPointcut" expression="execution(* com.enjoy.system.service..*(..)) or execution(* com.enjoy.commodity.service..*(..))" /> --> <aop:config> <aop:pointcut id="txPointcut" expression="(execution(* com.enjoy.system.service..*(..)) or execution(* com.enjoy.commodity.service..*(..)))" /> <aop:advisor pointcut-ref="txPointcut" advice-ref="txAdvice" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="set*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="edit*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="remove*" propagation="REQUIRED" /> <tx:method name="init*" propagation="REQUIRED" /> <tx:method name="get*" propagation="REQUIRED" read-only="true" /> <tx:method name="count*" propagation="REQUIRED" read-only="true" /> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="list*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" read-only="true" /> </tx:attributes> </tx:advice> 求解!!

怎样判断sqlSession按是否关闭

想自己实现事务,找到了sqlSession,想知道怎样判断sqlSession是否已关闭

spring mybatis 事务隔离级别

![现在采用的是spring默认的事务隔离级别](https://img-ask.csdn.net/upload/201511/25/1448416682_185666.png) 我数据库的主键是单独存放在一张公共表里面的,里面的数据如下: 表名|当前值 table1|20 然后通过一个存储过程来每次获取递增。 我配置的是service级别的事务。我在一个service里面把要插入的数据封装到List里面,多次调用自增长主键存储过程,发发现每次获取的都是相同的值。按理说我每次调用数据库里面的值就会从20变成21,依次类推。是不是默认的事务隔离级别是不提交我的事务。等全部执行成功之后才提交事务? 我应该配置成什么隔离级别比较合适?

sqlSession空指针异常

![图片说明](https://img-ask.csdn.net/upload/201906/18/1560790661_318734.png)运行的test代码 ![图片说明](https://img-ask.csdn.net/upload/201906/18/1560790679_202923.png)接口文件![图片说明](https://img-ask.csdn.net/upload/201906/18/1560790698_860434.png)sql映射文件 有没有夜夜给我指点一下江山T T,mybatis配置文件里的environment也就只有按照教材上面默认的一个。SQL映射器里的id跟接口,test的id一一对应了怎么还是一直空指针= =。

MyBatis与Oracle连接问题

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection ### Cause: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) at org.fkit.test.MyBatisTest.main(MyBatisTest.java:23) Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:345) at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:428) at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:515) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:345) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:201) at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:196) at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:93) at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:385) at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:89) at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:138) at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:60) at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49) 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) ... 2 more ```mybatis-config.xml <?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"> <!-- XML 配置文件包含对 MyBatis 系统的核心设置 --> <configuration> <!-- 指定 MyBatis 所用日志的具体实现 --> <settings> <setting name="logImpl" value="LOG4J"/> </settings> <environments default="development"> <!-- 环境配置,即连接的数据库。 --> <environment id="development"> <!-- 指定事务管理类型,type="JDBC"指直接简单使用了JDBC的提交和回滚设置 --> <transactionManager type="JDBC"/> <!-- dataSource指数据源配置,POOLED是JDBC连接对象的数据源连接池的实现。 --> <dataSource type="POOLED"> <property name="driver" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@192.168.*.*:1521:orcl"/> <property name="username" value="sm"/> <property name="password" value="123456"/> </dataSource> </environment> </environments> <!-- mappers告诉了MyBatis去哪里找持久化类的映射文件 --> <mappers> <mapper resource="org/fkit/mapper/UserMapper.xml"/> </mappers> </configuration> UserMapper.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"> <!-- namespace指用户自定义的命名空间。 --> <mapper namespace="org.fkit.mapper.UserMapper"> <!-- id="save"是唯一的标示符 parameterType属性指明插入时使用的参数类型 useGeneratedKeys="true"表示使用数据库的自动增长策略 --> <insert id="save" parameterType="org.fkit.domain.User" > INSERT INTO TB_USER(name,sex,age) VALUES(#{name},#{sex},#{age}) </insert> </mapper> User.java public class User implements Serializable{ // 用户标识 private Integer id; // 用户姓名 private String name; // 用户性别 private String sex; // 用户年龄 private Integer age; // 无参数构造器 public User() { super(); } // 有参数构造器 public User( String name, String sex, Integer age) { super(); this.name = name; this.sex = sex; this.age = age; } // setter和getter方法 public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } @Override public String toString() { return "User [id=" + id + ", name=" + name + ", sex=" + sex + ", age=" + age + "]"; } } MyBatisTest.java public class MyBatisTest { public static void main(String[] args) throws Exception { // 读取mybatis-config.xml文件 InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml"); // 初始化mybatis,创建SqlSessionFactory类的实例 SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder() .build(inputStream); // 创建Session实例 SqlSession session = sqlSessionFactory.openSession(); // 创建User对象 User user = new User("admin", "男", 26); // 插入数据 session.insert("org.fkit.mapper.UserMapper.save", user); // 提交事务 session.commit(); // 关闭Session session.close(); } } ``` ![图片说明](https://img-ask.csdn.net/upload/201709/18/1505748486_87603.png)

Mybatis中的二级缓存无效

在学习mybatis中的二级缓存的时候,出现了二级缓存测试没效果的情况,找了很久没找到原因,运行结果中也有二级缓存的Cache Hit Ratio 一、全局配置文件 ``` <settings> <setting name="lazyLoadingEnabled" value="true"/> <setting name="aggressiveLazyLoading" value="false"/> <setting name="cacheEnabled" value="true"/> </settings> ``` 二、namespace ``` <?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.gjhqq.mybatis_inf.EmployeeMapper"> <cache eviction="FIFO" flushInterval="60000" readOnly="true" size="1024"></cache> ``` 三、Test类 ``` @Test public void testSecondCache() throws IOException { SqlSession sqlSession1 = sqlSessionFactory().openSession(); SqlSession sqlSession2 = sqlSessionFactory().openSession(); try { EmployeeMapper employeeMapper1 = sqlSession1.getMapper(EmployeeMapper.class); EmployeeMapper employeeMapper2 = sqlSession2.getMapper(EmployeeMapper.class); Employee emp1 = employeeMapper1.selectOne(2); System.out.println(emp1); sqlSession1.close(); Employee emp2 = employeeMapper2.selectOne(2); System.out.println(emp2); sqlSession2.close(); } finally { } } ``` 运行结果: ``` DEBUG 03-02 13:20:55,243 Cache Hit Ratio [com.gjhqq.mybatis_inf.EmployeeMapper]: 0.0 (LoggingCache.java:62) DEBUG 03-02 13:20:55,249 ==> Preparing: select * from tbl_employee where id = ? (BaseJdbcLogger.java:145) DEBUG 03-02 13:20:55,267 ==> Parameters: 2(Integer) (BaseJdbcLogger.java:145) DEBUG 03-02 13:20:55,279 <== Total: 1 (BaseJdbcLogger.java:145) Employee [id=2, last_name=lisi, gender=1, email=hqq@gj.com, dept_id=2, dept=null] DEBUG 03-02 13:20:55,283 Cache Hit Ratio [com.gjhqq.mybatis_inf.EmployeeMapper]: 0.0 (LoggingCache.java:62) DEBUG 03-02 13:20:55,284 ==> Preparing: select * from tbl_employee where id = ? (BaseJdbcLogger.java:145) DEBUG 03-02 13:20:55,284 ==> Parameters: 2(Integer) (BaseJdbcLogger.java:145) DEBUG 03-02 13:20:55,285 <== Total: 1 (BaseJdbcLogger.java:145) Employee [id=2, last_name=lisi, gender=1, email=hqq@gj.com, dept_id=2, dept=null] ```

引入ref sqlSessionFactory 报红

``` <?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:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.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.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <!--读取数据源文件--> <context:property-placeholder location="jdbc.properties"></context:property-placeholder> <!--配置数据源--> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="jdbcUrl" value="${jdbc.url}"></property> <property name="user" value="${jdbc.username}"></property> <property name="password" value="${jdbc.password}"></property> <property name="driverClass" value="${jdbc.driver}"></property> </bean> <!--组件扫描--> <context:component-scan base-package="com.xxx"></context:component-scan> <!--spring整合mybatis--> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" > <property name="configLocation" value="mybatis-config.xml"></property> <property name="dataSource" ref="dataSource"></property> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" id="mapperScannerConfigurer"> <property name="basePackage" value="com.xxx.mapper"></property> <property name="sqlSessionFactoryBeanName" ref="sqlSessionFactory"></property> </bean> <!--mvc--> <mvc:annotation-driven></mvc:annotation-driven> </beans> ``` 引入sqlSessionFactory时编译器报红什么情况? ``` <property name="sqlSessionFactoryBeanName" ref="sqlSessionFactory"></property> ```这个地方报错

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

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

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

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

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

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

Linux命令学习神器!命令看不懂直接给你解释!

大家都知道,Linux 系统有非常多的命令,而且每个命令又有非常多的用法,想要全部记住所有命令的所有用法,恐怕是一件不可能完成的任务。 一般情况下,我们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个都可以实现我们的目标,但有没有更简便的方式呢? 答案是必须有的!今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势...

和黑客斗争的 6 天!

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

史上最全的 python 基础知识汇总篇,没有比这再全面的了,建议收藏

网友们有福了,小编终于把基础篇的内容全部涉略了一遍,这是一篇关于基础知识的汇总的文章,请朋友们收下,不用客气,不过文章篇幅肯能会有点长,耐心阅读吧爬虫(七十)多进程multiproces...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

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

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

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

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

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

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

新一代神器STM32CubeMonitor介绍、下载、安装和使用教程

关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang最近ST官网悄悄新上线了一款比较强大的工具:STM32CubeMonitor V1.0.0。经过我研究和使用之...

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

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

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

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

大学一路走来,学习互联网全靠这几个网站,最终拿下了一把offer

大佬原来都是这样炼成的

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

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

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

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

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

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

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

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

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

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

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

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

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

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

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

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

立即提问
相关内容推荐