spring 整合 es 中的 ElasticsearchRepository 20C

springboot 本人已经 整合完毕,es配置直接写在配置文件中,
然后按照网上的配置就可以使用ElasticsearchRepository。

但是如果是spring的话 会有问题,ElasticsearchRepository 这个类的 子类
应该是不同实例化的,也就是不用给他加@Bean这些注解,

但是我发现如果在spring中 这个类的加载会报错,内容如下

2018-12-23 01:58:11.252 [main] INFO  o.s.context.support.DefaultLifecycleProcessor - Starting beans in phase 2147483647
2018-12-23 01:58:11.260 [main] INFO  o.s.s.a.ScheduledAnnotationBeanPostProcessor - No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2018-12-23 01:58:11.279 [main] ERROR o.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@9573584] to prepare test instance [com.qinwell.tbcrm.task.test.es.ApiDemo@74919649]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.qinwell.tbcrm.task.test.es.ApiDemo': Unsatisfied dependency expressed through field 'memberRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.qinwell.tbcrm.task.test.es.MemberRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:386)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.qinwell.tbcrm.task.test.es.MemberRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1493)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
    ... 27 common frames omitted
2018-12-23 01:58:11.291 [Thread-7] INFO  o.s.context.support.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@1984b1f: startup date [Sun Dec 23 01:57:57 CST 2018]; root of context hierarchy
2018-12-23 01:58:11.293 [Thread-7] INFO  o.s.context.support.DefaultLifecycleProcessor - Stopping beans in phase 2147483647
Disconnected from the target VM, address: '127.0.0.1:60154', transport: 'socket'

Process finished with exit code 255

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SpringBoot2.0整合Elasticsearch6.0使用ElasticsearchRepository接口实践
SpringBoot2.0整合Elasticsearch6.0,使用SpringBoot对ES支持ElasticsearchRepository接口API,ElasticsearchTemplate接口API实现ES的增删改查实践
spring boot2.0 整合 ES 入门及异常记录
1、springboot版本 org.springframework.boot spring-boot-starter-parent 2.0.0.RELEASE 2、直接引入ES包 org.springframework
spring boot整合es慕课网教程
https://www.imooc.com/video/15775
Spring Boot整合es集群,消息存放ES
ES集群参数配置: elasticsearch.clustername = im_es elasticsearch.cluster.nodes = 10.**.**.**,10.**.**.**,10.**.**.** elasticsearch.cluster.port = 9300 pom.xml: <dependency> <groupId>org.e...
springboot整合ES入门
第一步是下载和安装ES,这个直接去官网下载即可,就不做过多的解释; 第二步创建一个springboot项目,直接去官网下载一个demo即可,在这里也不做过多介绍; 第三步在项目中导入依赖: 我这里使用的版本是5.6.4的,因为ES需要依赖log4j,所以你也需要导入log4j的依赖; 第四步写ES的配置类: 在这里有一个需要注意的是在java中使用ES所使用的端口是9300而不是9200,因为...
hive和es整合
第一步,加入对应版本的jar包到hive的lib目录下 如何知道hive的lib目录是什么呢 whereis hive 命令,可以找到hive的lib所在位置如图: 第二部 添加java和hive关联 hive命令进入hive CML(命令行) 执行如下命令 add jar /usr/lib/hive/lib/ elasticsearch-hadoop-7.0.0.jar; –注意7...
Sprngboot整合ES简单实现
简单集成ES 文中出现注解可在[https://blog.csdn.net/weixin_44008460/article/details/87549360] 1.maven依赖 <dependency> <groupId>org.springframework.boot</groupId> <arti...
springboot与es整合例子
springboot与es整合例子,基本的增删改查操作。。。。
Spring中整合Quartz定时任务
这几天用到了 记录一下 在Spring的配置文件里(我这里是applicationContext.xml)加入以下配置 根据个人情况,需要修改的地方: 1、自动执行的类路径 2、自动执行的方法 3、自动执行的时间 自动执行时间这里具体
spring mvc + es
spring mvc + es
springboot整合es启动报错的问题
今天打算用springboot整合es创建一个索引并往索引里面写数据的时候,项目启动的时候一直报下面的这个错误,错误大概如下, Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClie...
springboot整合es依赖问题
在springboot1.5.3上引用es客户端   springboot 1.5.3定义的es版本为2.4.1 <elasticsearch.version>2.4.6</elasticsearch.version> 在elaticsearch-rest-level-client里面引用了elasticsearch就为springboot里面定义的版本 ...
Docker 搭建 ES 集群并整合 Spring Boot
随着 Elasticsearch 生态越来越完善,当公司业务的高速发展及数据爆炸式的增长,某些业务场景需要多维度的搜索时,Elasticsearch 是最适合场景的。nn通过本次 Chat 可以带大
Spring Boot 2.0 整合 ES 5 文章内容搜索实战
本章内容文章内容搜索思路搜索内容分词搜索查询语句筛选条件分页、排序条件小结 一、文章内容搜索思路上一篇讲了在怎么在 Spring Boot 2.0 上整合 ES 5 ,这一篇聊聊具体实战。简单讲下如何实现文章、问答这些内容搜索的具体实现。实现思路很简单: 基于「短语匹配」并设置最小匹配权重值哪来的短语,利用 IK 分词器分词基于 Fite...
spring 整合spring mvc
spring整合spring mvc,通过IEDA进行整合,比较方便了~
spring 和jpa的整合中spring的扫描问题
我在spring配置文件中想用context:component-scan 进行扫描,把seveice.bean包中的类自动纳入spring中管理.代码如下:rnrnrn[color=#FF0000][/color]rn rn rn rn rn rn rn rn[color=#FF00FF]但是报出这样的错误:[/color]rnlog4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).rnlog4j:WARN Please initialize the log4j system properly.rnException in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 15 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)rn at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)rn at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)rn at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at ha.Test2.main(Test2.java:26)rnCaused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.rn at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)rn at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)rn at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)rn at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)rn at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)rn at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)rn at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)rn at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source)rn at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)rn at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)rn at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)rn ... 14 morern这是为什么呢,小弟刚学,还请高人告之.
spring boot中es使用示例
1.添加pom依赖 <!-- elasticsearch --> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> </dependency> <depe
Spring与Hibernate整合,Spring与Struts2整合源代码
详细介绍了用MyEclipse开发java EE的相关技术。主要有Spring与Hibernate整合,以及Spring与Struts2整合,每步操作都详细列出源代码,便于自学Spring,Hibernate与Hibernate(SSH)这3个开源框架
spring的整合
spring和hibernate的整合:   在spring的配置文件里加入如下配置: <!-- 配置sessionFactory --> <bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">               <p...
整合Spring
<p>rn <br />rn</p>rn<p>rn <p>rn 20周年限定一卡通!<span style="color:#337FE5;">可学Java全部课程</span>,仅售799元(原价7016元),<span style="color:#E53333;">还送漫威正版授权机械键盘+CSDN 20周年限量版T恤+智能编程助手!</span>rn </p>rn <p>rn 点此链接购买:rn </p>rn <table>rn <tbody>rn <tr>rn <td>rn <span style="color:#337FE5;"><a href="https://edu.csdn.net/topic/teachercard?utm_source=jsk20xqy" target="_blank">https://edu.csdn.net/topic/teachercard?utm_source=jsk20xqy</a><br />rn</span>rn </td>rn </tr>rn </tbody>rn </table>rn</p>rn<span>&nbsp;</span> rn<p>rn <br />rn</p>rn针对企业开发的主流框架进行讲解,注重理论和实践的结合,课程内容深入源码,讲解深入浅出,每个技术点都配备具有典型性和实用性的案例及代码。使学生具备开发企业级项目的能力,同时针对框架新特性也有讲授,通过这些新功能实用性强、易用性高,可大幅降低 JavaEE 开发的难度,同时有效提升应用开发的优雅性。
在Struts2中整合Spring的IoC
博文链接:https://yanghaiskys.iteye.com/blog/234790
web中spring与jpa整合
1:新建WEB工程,加入Maven的支持。   2:pom.xml xml version="1.0" encoding="UTF-8"?> project xmlns="http://maven.apache.org/POM/4.0.0"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schema
在整合spring 和hibernate中,出现问题
错误异常rnrnHibernate: rn insert rn intorn Studentsrn (sname) rn valuesrn (?)rn?是不是没有获取到值rn[code=java]org.hibernate.exception.SQLGrammarException: could not insert: [net.sqt.vo.Students]rn at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)rn at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2327)rn at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2834)rn at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)rn at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)rn at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320)rn at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:713)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:701)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:697)rn at net.sqt.dao.impl.StudentsDAOImpl.saveStudents(StudentsDAOImpl.java:29)rn at net.sqt.proxy.TestStudentsDAOImpl.testSaveStudents(TestStudentsDAOImpl.java:15)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:483)rn at junit.framework.TestCase.runTest(TestCase.java:176)rn at junit.framework.TestCase.runBare(TestCase.java:141)rn at junit.framework.TestResult$1.protect(TestResult.java:122)rn at junit.framework.TestResult.runProtected(TestResult.java:142)rn at junit.framework.TestResult.run(TestResult.java:125)rn at junit.framework.TestCase.run(TestCase.java:129)rn at junit.framework.TestSuite.runTest(TestSuite.java:255)rn at junit.framework.TestSuite.run(TestSuite.java:250)rn at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)rnCaused by: com.microsoft.sqlserver.jdbc.SQLServerException: 对象名 'Students' 无效。rn at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)rn at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)rn at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)rn at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)rn at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)rn at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)rn at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)rn at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)rn at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314)rn at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)rn at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)rn at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)rn ... 36 morern[/code]rnrnrn这边有报错说对象名 'Students' 无效。我没有设置表名。rnapplicationContext.xml 代码如下rn[code=java]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn net.sqt.vo.Studentsrn rn rn rn rn org.hibernate.dialect.SQLServerDialect rn true rn true rn create rn rn rn rn[/code]rnrn实体类StudentsDAOImpl.javarn[code=java]package net.sqt.dao.impl;rnrnimport javax.annotation.Resource;rnrnimport org.hibernate.SessionFactory;rnimport org.hibernate.classic.Session;rnrnimport net.sqt.dao.StudentsDAO;rnimport net.sqt.vo.Students;rnrnrnpublic class StudentsDAOImpl implements StudentsDAOrn private SessionFactory sessionFactory;rnrn public SessionFactory getSessionFactory() rn return sessionFactory;rn rn @Resourcern public void setSessionFactory(SessionFactory sessionFactory) rn this.sessionFactory = sessionFactory;rn rnrn @Overridern public void saveStudents() throws Exceptionrn // TODO Auto-generated method stubrn Students s=new Students();rn s.setSname("232");rn Session session=sessionFactory.openSession();rn session.save(s);rn rnrn[/code]rnrnStudents.javarn[code=java]package net.sqt.vo;rnrnimport javax.persistence.Entity;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.Id;rnrn@Entityrnpublic class Students rn private int sid;rn private String sname;rn @Idrn @GeneratedValuern public int getSid() rn return sid;rn rnrn public void setSid(int sid) rn this.sid = sid;rn rnrn public String getSname() rn return sname;rn rnrn public void setSname(String sname) rn this.sname = sname;rn rnrn[/code]rnrn接口类rnStudentsDAO.javarn[code=java]package net.sqt.dao;rnrnpublic interface StudentsDAO rn //保存学生资料rn public void saveStudents() throws Exception;rnrn[/code]
Spring与Hibernate整合中的数据源配置
Spring中的数据源一般用到三种: 1.使用Spring自带的 DriverManagerDataSource  配置方式有两种: 一种通过 property 属性配置 id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> name="driverClass
spring与mybatis 整合中的问题
在spring和mybatis整合中,applicationContext.xml中配置一般会配置两个属性: 1.dataSource这个不多说,可以用mybatis自带的datasource,也可以用连接池。 [code=&quot;java&quot;] [/code] ...
在myeclipse中如何整合spring?
如何在myeclipse中应用spring,是直接把spring.jar导入旧可以 ,还是myeclipse中自带spring,那位大哥能具体说一下...小弟先谢谢了!!!再就是我想在项目栏里看到我导入的类包,该如何设置?
SSM中spring与mybatis整合
这里面涵盖了mybatis与spring 整合开发所需的加入包,希望对你有所帮助
spring中整合c3p0的配置
Spring中配置c3p0 首先下载c3p0.jar,放到classpath中 然后修改spring的数据源,如下 &amp;lt;bean id=&quot;dataSource&quot; class=&quot;com.mchange.v2.c3p0.ComboPooledDataSource&quot; destroy-method=&quot;close&quot;&amp;gt; &amp;lt;property name=&quot;driv...
Spring Boot中整合Sharding-JDBC
NULL 博文链接:https://huangyongxing310.iteye.com/blog/2434356
在spring中整合memcached缓存
memcached是内存级缓存、相对于其他内存缓存数据库redis或mongoDB而言、memcached速度是最快的 下面整理下在spring项目中memcached的使用
Axis2在Web项目中整合Spring
一、说明: 上一篇说了Axis2与Web项目的整合(详情 :Axis2与Web项目整合)过程,如果说在Web项目中使用了Spring框架,那么又改如何进行Axis2相关的配置操作呢? 二、Axis2 与 Spring 整合 ① 新建项目 AxisSpringDemo,并在其中加入 Axis2 与 Spring 相关的 jar 包 Spring所需 Jar : aopall...
SSM项目整合-整合Spring
整合Spring的步骤因为原来的项目已经使用Maven进行了整合,所以整合Spring是在Maven的基础之上进行的。
SSH整合(整合Spring与Hibernate)
协同办公系统是在实际工作之中进行项目布置与监督的有效服务平台。在本课程之中主要是为读者讲解协同办公平台的项目及任务管理部分,同时也提供有资源信息共享功能。官方QQ群:612148723。
spring 整合hibernate整合方式
spring整和hibernate属于向下整合,spring的核心是管理各个类的生命周期和类与类之间的关系,所有,当提及到spring整合hibernate,就是heibinate将自己最核心的类交给spring来管理,既SessionFactory,这样一来,也相当于管理了hibernate的所有内容:包括数据源(四大基本连库信息,连接池,线程池等,),自有属性,映射文件,以下是spring整合h
ssh整合之整合hibernate和spring
配置SessionFactory在applicationContext.xml中&amp;lt;bean name=&quot;sessionFactory&quot; class=&quot;org.springframework.orm.hibernate5.LocalSessionFactoryBean&quot; &amp;gt; &amp;lt;!-- 将连接池注入到sessionFactory, hibernate会通过连接池获得连接 --&amp;gt...
spring 整合flex,整合webService
关于webService的应用 非常详细
整合框架(1)整合Spring
Activiti工作流视频教程,围绕BPMN2.0规范学习最新的Activiti6.0框架,可掌握工作流引擎Activiti、规则Drool等常用的企业应用技术。 有Java基础的开发人员,准备使用工作流技术的团队
ES与spring boot集成 杂烩
主要是摘抄其他博客,汇成此篇,主要是担心自己忘了 做些笔记和链接 首先推荐《ElasticsearchTemplate的详细使用,完成多条件查询、匹配度查询等》写的很好,图看不到的请点击查看 https://blog.csdn.net/tianyaleixiaowu/article/details/76149547《ElasticSearchRepository和ElasticSearchTe...
SSM整合——持久层的整合(spring和mybatis的整合)
学完ssm后,需要把三大框架整合起来,下面我们就来看一下。 第一步:搭建环境: 将所需要的jar包导入,jar包包括: 1.Mybatis核心和Mybatis依赖包 2.Mybatis和spring整合包 3.Spring的jar(包括springmvc的jar包) 4.数据库驱动包 5.第三方数据库连接池 由于jar包比较多,不一一解释。需要的可以留下你的邮箱,我可以发给你。 ...
spring总结5——Spring和mybatis整合、spring和servlet整合
目录 1、Spring和mybatis整合 1、整合什么东西? 2、需要的jar包 3、mybatis配置文件内容 4、spring配置文件内容 1、开启注解扫描 2、配置C3p0连接池 3、配置SqlSessionFactory 4、配置MapperScannerConfigurer 5、代码汇总: 2、spring和servlet整合 1、整合什么 2、整合步骤 1...
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview