Spring的注入问题
作下笔记,Spring的注入问题[多个实例问题]
解决方案如下:
package student.life.support.platform.service.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import student.life.support.platform.dao.BaseDao; import student.life.support.platform.model.User; import student.life.support.platform.service.UserService; @Service public class UserServiceImpl extends BaseServiceImpl<User> implements UserService { public UserServiceImpl(){ System.out.println(getClass()); } @Resource private BaseDao<User> baseDao; @Resource public void setBaseDao(BaseDao<User> baseDao) { System.out.println("注入baseDao实例对象"); super.setBaseDao(baseDao); } } 注入的时候错了,注入了baseDao,实际上要注入的是BaseDao的实现类的子类,即BaseDaoImpl的子类,而不是baseDao本身。 奇葩的struts2: package student.life.support.platform.model; // default package import java.sql.Timestamp; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenericGenerator; /** * User entity. @author MyEclipse Persistence Tools */ @Entity @Table(name = "user", catalog = "studentlifesupportplatform") public class User implements java.io.Serializable { // Fields private String id; private Role role; private String username; private String studentNum; private String address; private Integer age; private String nickname; private String sex; private String qq; private String phonenumber; private String fixedTelephone; private String password; private Timestamp registerDate; private String imgUrl; private String email; private String question; private String answer; private Timestamp totalOnlineDate; private Set<OperatingHistory> operatingHistories = new HashSet<OperatingHistory>( 0); private Set<HelpInfoBoard> helpInfoBoards = new HashSet<HelpInfoBoard>(0); private Set<ReplyInfo> replyInfos = new HashSet<ReplyInfo>(0); private Set<HelpInfo> helpInfos = new HashSet<HelpInfo>(0); private Set<Credit> credits = new HashSet<Credit>(0); @Override public String toString() { System.out.println("id:" + id); System.out.println("role:" + role); System.out.println("username:" + username); System.out.println("studentNum:" + studentNum); System.out.println("address:" + address); return ""; } // Constructors /** default constructor */ public User() { } /** minimal constructor */ public User(String id) { this.id = id; } /** full constructor */ public User(String id, Role role, String username, String studentNum, String address, Integer age, String nickname, String sex, String qq, String phonenumber, String fixedTelephone, String password, Timestamp registerDate, String imgUrl, String email, String question, String answer, Timestamp totalOnlineDate, Set<OperatingHistory> operatingHistories, Set<HelpInfoBoard> helpInfoBoards, Set<ReplyInfo> replyInfos, Set<HelpInfo> helpInfos, Set<Credit> credits) { this.id = id; this.role = role; this.username = username; this.studentNum = studentNum; this.address = address; this.age = age; this.nickname = nickname; this.sex = sex; this.qq = qq; this.phonenumber = phonenumber; this.fixedTelephone = fixedTelephone; this.password = password; this.registerDate = registerDate; this.imgUrl = imgUrl; this.email = email; this.question = question; this.answer = answer; this.totalOnlineDate = totalOnlineDate; this.operatingHistories = operatingHistories; this.helpInfoBoards = helpInfoBoards; this.replyInfos = replyInfos; this.helpInfos = helpInfos; this.credits = credits; } // Property accessors @GenericGenerator(name = "generator", strategy = "uuid") @Id @GeneratedValue(generator = "generator") @Column(name = "id", unique = true, nullable = false, length = 32) public String getId() { return this.id; } public void setId(String id) { this.id = id; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "role_id") public Role getRole() { return this.role; } public void setRole(Role role) { this.role = role; } @Column(name = "username", length = 32) public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } @Column(name = "student_num", length = 32) public String getStudentNum() { return this.studentNum; } public void setStudentNum(String studentNum) { this.studentNum = studentNum; } @Column(name = "address", length = 64) public String getAddress() { return this.address; } public void setAddress(String address) { System.out.println("拦截:" + address); this.address = address; } @Column(name = "age") public Integer getAge() { return this.age; } public void setAge(Integer age) { this.age = age; } @Column(name = "nickname", length = 16) public String getNickname() { return this.nickname; } public void setNickname(String nickname) { this.nickname = nickname; } @Column(name = "sex", length = 4) public String getSex() { return this.sex; } public void setSex(String sex) { this.sex = sex; } @Column(name = "qq", length = 16) public String getQq() { return this.qq; } public void setQq(String qq) { this.qq = qq; } @Column(name = "phonenumber", length = 20) public String getPhonenumber() { return this.phonenumber; } public void setPhonenumber(String phonenumber) { this.phonenumber = phonenumber; } @Column(name = "fixed_telephone", length = 16) public String getFixedTelephone() { return this.fixedTelephone; } public void setFixedTelephone(String fixedTelephone) { this.fixedTelephone = fixedTelephone; } @Column(name = "password", length = 64) public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } @Column(name = "register_date", length = 19) public Timestamp getRegisterDate() { return this.registerDate; } public void setRegisterDate(Timestamp registerDate) { this.registerDate = registerDate; } @Column(name = "img_url", length = 128) public String getImgUrl() { return this.imgUrl; } public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } @Column(name = "email", length = 64) public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } @Column(name = "question", length = 64) public String getQuestion() { return this.question; } public void setQuestion(String question) { this.question = question; } @Column(name = "answer", length = 64) public String getAnswer() { return this.answer; } public void setAnswer(String answer) { this.answer = answer; } @Column(name = "total_online_date", length = 19) public Timestamp getTotalOnlineDate() { return this.totalOnlineDate; } public void setTotalOnlineDate(Timestamp totalOnlineDate) { this.totalOnlineDate = totalOnlineDate; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user") public Set<OperatingHistory> getOperatingHistories() { return this.operatingHistories; } public void setOperatingHistories(Set<OperatingHistory> operatingHistories) { this.operatingHistories = operatingHistories; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user") public Set<HelpInfoBoard> getHelpInfoBoards() { return this.helpInfoBoards; } public void setHelpInfoBoards(Set<HelpInfoBoard> helpInfoBoards) { this.helpInfoBoards = helpInfoBoards; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user") public Set<ReplyInfo> getReplyInfos() { return this.replyInfos; } public void setReplyInfos(Set<ReplyInfo> replyInfos) { this.replyInfos = replyInfos; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user") public Set<HelpInfo> getHelpInfos() { return this.helpInfos; } public void setHelpInfos(Set<HelpInfo> helpInfos) { this.helpInfos = helpInfos; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user") public Set<Credit> getCredits() { return this.credits; } public void setCredits(Set<Credit> credits) { this.credits = credits; } } public class UserAction extends BaseAction { private User user;//PO不用加注解 @Resource private UserService userService; public String go(){ System.out.println("GO GO GO"); return SUCCESS; } public String save(){ System.out.println("SAVE....."); System.out.println(user); String id = (String) userService.save(user); System.out.println("id = " + id); return SUCCESS; } public void setUser(User user) { this.user = user; } /*public User getUser() { return user; }*/ } 如果没有加进getUser方法,则通过struts2底层发反射生成的User对象中只有username属性有被赋值,其他属性则是null值,即使通过链接请求传参到后台,User对象的属性(除了username)都是null;为了彻底理解这个东东,就要去看struts2的源码了。 java.lang.IllegalArgumentException: id to load is required for loading 主要是一些字段的值为null,然后传到dao层,调用了HibernateTemplate的方法的时候,就会报错了。注意参数的值,在调用HibernateTemplate的方法之前进行参数判断。
为了便于搜索到这个问题,把异常信息贴上来:
Specification title is null! Using 'jrebel' instead. null: Starting logging to file: D:\学习资料汇总\三大框架\三大框架需要的包\jrebel5.3.2\jrebel.log 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: ############################################################# 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: null Unknown (null) 2014-06-02 19:07:57 Test: (c) Copyright ZeroTurnaround OU, Estonia, Tartu. 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: Over the last 30 days null prevented 2014-06-02 19:07:57 Test: at least 91 redeploys/restarts saving you about 0.1 hours. 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: Over the last 143 days null prevented 2014-06-02 19:07:57 Test: at least 449 redeploys/restarts saving you about 0.4 hours. 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: This product is licensed to www.sdandroid.com 2014-06-02 19:07:57 Test: for unlimited number of developer seats on site. 2014-06-02 19:07:57 Test: ####### Cracked by sdandroid (blog@sdandroid.com) ###### 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: The following plugins are disabled at the moment: 2014-06-02 19:07:57 Test: * ADF Core plugin (set -Drebel.adf_core_plugin=true to enable) 2014-06-02 19:07:57 Test: * ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable) 2014-06-02 19:07:57 Test: * Axis2 plugin (set -Drebel.axis2_plugin=true to enable) 2014-06-02 19:07:57 Test: * Camel plugin (set -Drebel.camel_plugin=true to enable) 2014-06-02 19:07:57 Test: * Click plugin (set -Drebel.click_plugin=true to enable) 2014-06-02 19:07:57 Test: * Deltaspike plugin (set -Drebel.deltaspike_plugin=true to enable) 2014-06-02 19:07:57 Test: * Eclipse RCP Plugin (set -Drebel.eclipse_plugin=true to enable) 2014-06-02 19:07:57 Test: * JRuby Plugin (set -Drebel.jruby_plugin=true to enable) 2014-06-02 19:07:57 Test: * Jersey plugin (set -Drebel.jersey_plugin=true to enable) 2014-06-02 19:07:57 Test: * Log4j2 plugin (set -Drebel.log4j2_plugin=true to enable) 2014-06-02 19:07:57 Test: * Mustache Plugin (set -Drebel.mustache_plugin=true to enable) 2014-06-02 19:07:57 Test: * RESTlet plugin (set -Drebel.restlet_plugin=true to enable) 2014-06-02 19:07:57 Test: * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable) 2014-06-02 19:07:57 Test: * Spring Data Plugin (set -Drebel.spring_data_plugin=true to enable) 2014-06-02 19:07:57 Test: * Thymeleaf Plugin (set -Drebel.thymeleaf_plugin=true to enable) 2014-06-02 19:07:57 Test: * VRaptor plugin (set -Drebel.vraptor_plugin=true to enable) 2014-06-02 19:07:57 Test: * Vaadin CDI utils plugin (set -Drebel.vaadin_cdiutils_plugin=true to enable) 2014-06-02 19:07:57 Test: * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable) 2014-06-02 19:07:57 Test: 2014-06-02 19:07:57 Test: ############################################################# 2014-06-02 19:07:57 Test: 2014-6-2 19:07:57 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\SoftwareDeveloping\jdk1.6.0_35\bin;D:\SoftwareDeveloping\tomcat7.0.35\bin 2014-6-2 19:07:58 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 2014-6-2 19:07:58 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-bio-8009"] 2014-6-2 19:07:58 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 731 ms 2014-6-2 19:07:58 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 2014-6-2 19:07:58 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.35 2014-6-2 19:07:58 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\docs 2014-6-2 19:07:58 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\examples 2014-6-2 19:07:59 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 2014-6-2 19:07:59 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 2014-6-2 19:07:59 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@58e862c') 2014-6-2 19:07:59 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\host-manager 2014-6-2 19:07:59 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\manager 2014-6-2 19:07:59 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\Parameters 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/core is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined 2014-6-2 19:08:01 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined 2014-6-2 19:08:02 com.sun.faces.config.ConfigureListener contextInitialized 信息: 初始化上下文 '/Parameters' 的 Mojarra 2.0.3 (FCS b03) 2014-6-2 19:08:02 com.sun.faces.spi.InjectionProviderFactory createInstance 信息: JSF1048:有 PostConstruct/PreDestroy 注释。标有这些注释的 ManagedBeans 方法将表示注释已处理。 2014-6-2 19:08:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Parsing configuration file [struts-default.xml] 2014-6-2 19:08:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Parsing configuration file [struts-plugin.xml] 2014-6-2 19:08:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Parsing configuration file [struts.xml] 2014-6-2 19:08:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Overriding property struts.i18n.reload - old value: false new value: true 2014-6-2 19:08:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: Overriding property struts.configuration.xml.reload - old value: false new value: true 2014-6-2 19:08:04 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\ROOT 2014-06-02 19:08:04 Test: Directory 'F:\Workplace\Myeclipse\StudentLifeSupportPlatformSystem\WebRoot\WEB-INF\classes' will be monitored for changes. 2014-06-02 19:08:04 Test: Directory 'F:\Workplace\Myeclipse\StudentLifeSupportPlatformSystem\WebRoot' will be monitored for changes. 2014-6-2 19:08:04 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory D:\SoftwareDeveloping\tomcat7.0.35\webapps\StudentLifeSupportPlatformSystem 2014-06-02 19:08:07 Test: Monitoring Log4j configuration in 'file:/F:/Workplace/Myeclipse/StudentLifeSupportPlatformSystem/WebRoot/WEB-INF/classes/log4j.properties'. 2014-6-2 19:08:07 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext INFO org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization started INFO org.springframework.web.context.support.XmlWebApplicationContext Refreshing org.springframework.web.context.support.XmlWebApplicationContext@5515e852: display name [Root WebApplicationContext]; startup date [Mon Jun 02 19:08:07 CST 2014]; root of context hierarchy 2014-06-02 19:08:07 Test: Monitoring Spring bean definitions in 'F:\Workplace\Myeclipse\StudentLifeSupportPlatformSystem\WebRoot\WEB-INF\classes\beans.xml'. INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from class path resource [beans.xml] INFO org.springframework.web.context.support.XmlWebApplicationContext Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@5515e852]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5bfc96bf INFO org.springframework.beans.factory.support.DefaultListableBeanFactory Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5bfc96bf: defining beans [sessionFactory,hibernateTemplate,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,creditDaoImpl,helpInfoBoardDaoImpl,helpInfoDaoImpl,operatingHistoryDaoImpl,replyInfoDaoImpl,roleDaoImpl,userDaoImpl,creditServiceImpl,helpInfoBoardServiceImpl,helpInfoServiceImpl,operatingHistoryServiceImpl,replyInfoServiceImpl,roleServiceImpl,userServiceImpl,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,transactionAdvice,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0]; root of factory hierarchy INFO org.hibernate.cfg.annotations.Version Hibernate Annotations 3.4.0.GA INFO org.hibernate.cfg.Environment Hibernate 3.3.2.GA INFO org.hibernate.cfg.Environment hibernate.properties not found INFO org.hibernate.cfg.Environment Bytecode provider name : javassist INFO org.hibernate.cfg.Environment using JDK 1.4 java.sql.Timestamp handling INFO org.hibernate.annotations.common.Version Hibernate Commons Annotations 3.1.0.GA INFO org.hibernate.cfg.Configuration configuring from url: file:/F:/Workplace/Myeclipse/StudentLifeSupportPlatformSystem/WebRoot/WEB-INF/classes/hibernate.cfg.xml INFO org.hibernate.cfg.Configuration Configured SessionFactory: null INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.Credit INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.Credit on table credit INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.HelpInfo INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.HelpInfo on table help_info INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.HelpInfoBoard INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.HelpInfoBoard on table help_info_board INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.OperatingHistory INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.OperatingHistory on table operating_history INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.ReplyInfo INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.ReplyInfo on table reply_info INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.Role INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.Role on table role INFO org.hibernate.cfg.AnnotationBinder Binding entity from annotated class: student.life.support.platform.model.User INFO org.hibernate.cfg.annotations.EntityBinder Bind entity student.life.support.platform.model.User on table user INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.HelpInfoBoard.helpInfos -> help_info INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.Role.users -> user INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.User.credits -> credit INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.User.helpInfoBoards -> help_info_board INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.User.helpInfos -> help_info INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.User.operatingHistories -> operating_history INFO org.hibernate.cfg.annotations.CollectionBinder Mapping collection: student.life.support.platform.model.User.replyInfos -> reply_info INFO org.hibernate.validator.Version Hibernate Validator 3.1.0.GA INFO org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean Building new Hibernate SessionFactory INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. INFO org.hibernate.connection.ConnectionProviderFactory Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider INFO org.hibernate.connection.C3P0ConnectionProvider C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/studentlifesupportplatform INFO org.hibernate.connection.C3P0ConnectionProvider Connection properties: {user=root, password=****} INFO org.hibernate.connection.C3P0ConnectionProvider autocommit mode: false INFO com.mchange.v2.log.MLog MLog clients using log4j logging. INFO com.mchange.v2.c3p0.C3P0Registry Initializing c3p0-0.9.0.2 [built 26-September-2005 12:55:26 -0400; debug? true; trace: 10] INFO com.mchange.v2.c3p0.PoolBackedDataSource Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@7fd2443b [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@3902274f [ acquireIncrement -> 5, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 3902274f, idleConnectionTestPeriod -> 120, initialPoolSize -> 5, maxIdleTime -> 300, maxPoolSize -> 60, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@36befe4 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 36befe4, jdbcUrl -> jdbc:mysql://localhost:3306/studentlifesupportplatform, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 7fd2443b, numHelperThreads -> 3 ] INFO org.hibernate.cfg.SettingsFactory RDBMS: MySQL, version: 5.5.16 INFO org.hibernate.cfg.SettingsFactory JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.17 ( Revision: ${bzr.revision-id} ) INFO org.hibernate.dialect.Dialect Using dialect: org.hibernate.dialect.MySQLDialect INFO org.hibernate.transaction.TransactionFactoryFactory Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory INFO org.hibernate.transaction.TransactionManagerLookupFactory No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) INFO org.hibernate.cfg.SettingsFactory Automatic flush during beforeCompletion(): disabled INFO org.hibernate.cfg.SettingsFactory Automatic session close at end of transaction: disabled INFO org.hibernate.cfg.SettingsFactory JDBC batch size: 15 INFO org.hibernate.cfg.SettingsFactory JDBC batch updates for versioned data: disabled INFO org.hibernate.cfg.SettingsFactory Scrollable result sets: enabled INFO org.hibernate.cfg.SettingsFactory JDBC3 getGeneratedKeys(): enabled INFO org.hibernate.cfg.SettingsFactory Connection release mode: auto INFO org.hibernate.cfg.SettingsFactory Maximum outer join fetch depth: 2 INFO org.hibernate.cfg.SettingsFactory Default batch fetch size: 1 INFO org.hibernate.cfg.SettingsFactory Generate SQL with comments: disabled INFO org.hibernate.cfg.SettingsFactory Order SQL updates by primary key: disabled INFO org.hibernate.cfg.SettingsFactory Order SQL inserts for batching: disabled INFO org.hibernate.cfg.SettingsFactory Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory Using ASTQueryTranslatorFactory INFO org.hibernate.cfg.SettingsFactory Query language substitutions: {} INFO org.hibernate.cfg.SettingsFactory JPA-QL strict compliance: disabled INFO org.hibernate.cfg.SettingsFactory Second-level cache: enabled INFO org.hibernate.cfg.SettingsFactory Query cache: disabled INFO org.hibernate.cfg.SettingsFactory Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory INFO org.hibernate.cfg.SettingsFactory Optimize cache for minimal puts: disabled INFO org.hibernate.cfg.SettingsFactory Structured second-level cache entries: disabled INFO org.hibernate.cfg.SettingsFactory Echoing all SQL to stdout INFO org.hibernate.cfg.SettingsFactory Statistics: disabled INFO org.hibernate.cfg.SettingsFactory Deleted entity synthetic identifier rollback: disabled INFO org.hibernate.cfg.SettingsFactory Default entity-mode: pojo INFO org.hibernate.cfg.SettingsFactory Named query checking : enabled INFO org.hibernate.impl.SessionFactoryImpl building session factory INFO org.hibernate.impl.SessionFactoryObjectFactory Not binding factory to JNDI, no JNDI name configured INFO org.hibernate.tool.hbm2ddl.SchemaUpdate Running hbm2ddl schema update INFO org.hibernate.tool.hbm2ddl.SchemaUpdate fetching database metadata INFO org.hibernate.tool.hbm2ddl.SchemaUpdate updating schema INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.credit INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [id, user_integral, user_id, credit_rank] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [credit_ibfk_1] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [primary, user_id] INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.help_info INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [content, id, user_qq, title, reward_integral, user_phone, accept_help, user_id, place, board_id, date_time, help_type] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [help_info_ibfk_2, help_info_ibfk_1] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [primary, user_id, board_id] INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.help_info_board INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [img_url, id, user_id, board_description, date_time, board_name] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [help_info_board_ibfk_1] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [primary, user_id] INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.operating_history INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [id, operate_url, operate_content, operate_date, user_id, operate_page, ip] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [operating_history_ibfk_1] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [primary, user_id] INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.reply_info INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [content, data_time, id, user_id, help_info_id, ip] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [reply_info_ibfk_1] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [primary, user_id] INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.role INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [id, role_permissions, role_type] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [primary] INFO org.hibernate.tool.hbm2ddl.TableMetadata table found: studentlifesupportplatform.user INFO org.hibernate.tool.hbm2ddl.TableMetadata columns: [img_url, fixed_telephone, phonenumber, total_online_date, sex, student_num, role_id, nickname, answer, password, id, username, email, address, register_date, age, question, qq] INFO org.hibernate.tool.hbm2ddl.TableMetadata foreign keys: [user_ibfk_1] INFO org.hibernate.tool.hbm2ddl.TableMetadata indexes: [role_id, primary] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate schema update complete class student.life.support.platform.service.impl.UserServiceImpl INFO org.springframework.beans.factory.support.DefaultListableBeanFactory Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5bfc96bf: defining beans [sessionFactory,hibernateTemplate,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,creditDaoImpl,helpInfoBoardDaoImpl,helpInfoDaoImpl,operatingHistoryDaoImpl,replyInfoDaoImpl,roleDaoImpl,userDaoImpl,creditServiceImpl,helpInfoBoardServiceImpl,helpInfoServiceImpl,operatingHistoryServiceImpl,replyInfoServiceImpl,roleServiceImpl,userServiceImpl,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,transactionAdvice,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0]; root of factory hierarchy INFO org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean Closing Hibernate SessionFactory INFO org.hibernate.impl.SessionFactoryImpl closing ERROR org.springframework.web.context.ContextLoader Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of resource fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [student.life.support.platform.dao.BaseDao] is defined: expected single matching bean but found 7: [creditDaoImpl, helpInfoBoardDaoImpl, helpInfoDaoImpl, operatingHistoryDaoImpl, replyInfoDaoImpl, roleDaoImpl, userDaoImpl] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:292) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291) 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:633) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [student.life.support.platform.dao.BaseDao] is defined: expected single matching bean but found 7: [creditDaoImpl, helpInfoBoardDaoImpl, helpInfoDaoImpl, operatingHistoryDaoImpl, replyInfoDaoImpl, roleDaoImpl, userDaoImpl] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:621) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537) at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180) at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:289) ... 30 more 2014-6-2 19:08:11 org.apache.catalina.core.StandardContext listenerStart 严重: 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 'userServiceImpl': Injection of resource fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [student.life.support.platform.dao.BaseDao] is defined: expected single matching bean but found 7: [creditDaoImpl, helpInfoBoardDaoImpl, helpInfoDaoImpl, operatingHistoryDaoImpl, replyInfoDaoImpl, roleDaoImpl, userDaoImpl] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:292) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291) 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:633) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [student.life.support.platform.dao.BaseDao] is defined: expected single matching bean but found 7: [creditDaoImpl, helpInfoBoardDaoImpl, helpInfoDaoImpl, operatingHistoryDaoImpl, replyInfoDaoImpl, roleDaoImpl, userDaoImpl] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:621) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537) at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180) at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:289) ... 30 more 2014-6-2 19:08:11 com.sun.faces.config.ConfigureListener contextInitialized 信息: 初始化上下文 '/StudentLifeSupportPlatformSystem' 的 Mojarra 2.0.3 (FCS b03) 2014-6-2 19:08:12 com.sun.faces.spi.InjectionProviderFactory createInstance 信息: JSF1048:有 PostConstruct/PreDestroy 注释。标有这些注释的 ManagedBeans 方法将表示注释已处理。 2014-6-2 19:08:12 org.apache.catalina.core.StandardContext startInternal 严重: Error listenerStart 2014-6-2 19:08:12 org.apache.catalina.core.StandardContext startInternal 严重: Context [/StudentLifeSupportPlatformSystem] startup failed due to previous errors 2014-6-2 19:08:12 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2014-6-2 19:08:12 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 严重: The web application [/StudentLifeSupportPlatformSystem] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 2014-6-2 19:08:12 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 严重: The web application [/StudentLifeSupportPlatformSystem] created a ThreadLocal with key of type [com.sun.faces.util.Util$1] (value [com.sun.faces.util.Util$1@3dbe12fe]) and a value of type [java.util.HashMap] (value [{com.sun.faces.patternCache={ = }}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 2014-6-2 19:08:12 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-8080"] 2014-6-2 19:08:12 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-bio-8009"] 2014-6-2 19:08:12 org.apache.catalina.startup.Catalina start 信息: Server startup in 14684 ms
欢迎讨论交流, 我的主页:http://www.cnblogs.com/GDUT/
我的邮箱:zone.technology.exchange@gmail.com
Spring的注入问题的更多相关文章
- Spring自动注入properties文件
实现spring 自动注入属性文件中的key-value. 1.在applicationContext.xml配置文件中,引入<util />命名空间. xmlns:util=" ...
- spring 属性注入
Spring的核心技术室依赖注入,下面是依赖注入之属性注入的实现过程,牛刀小试,请看效果. 1.首先添加Spring.Web引用.本例中是使用分层思想来演示的,下面是项目的结构和UserModel类的 ...
- spring 多线程 注入 服务层 问题
在用多线程的时候,里面要用到Spring注入服务层,或者是逻辑层的时候,一般是注入不进去的.具体原因应该是线程启动时没有用到Spring实例不池.所以注入的变量值都为null. 详细:http://h ...
- Spring 依赖注入方式详解
平常的Java开发中,程序员在某个类中需要依赖其它类的方法. 通常是new一个依赖类再调用类实例的方法,这种开发存在的问题是new的类实例不好统一管理. Spring提出了依赖注入的思想,即依赖类不由 ...
- Spring依赖注入(IOC)那些事
小菜使用Spring有几个月了,但是对于它的内部原理,却是一头雾水,这次借着工作中遇到的一个小问题,来总结一下Spring. Spring依赖注入的思想,就是把对象交由Spring容器管理,使用者只需 ...
- Spring依赖注入三种方式详解
在讲解Spring依赖注入之前的准备工作: 下载包含Spring的工具jar包的压缩包 解压缩下载下来的Spring压缩包文件 解压缩之后我们会看到libs文件夹下有许多jar包,而我们只需要其中的c ...
- Spring依赖注入:注解注入总结
更多11 spring 依赖注入 注解 java 注解注入顾名思义就是通过注解来实现注入,Spring和注入相关的常见注解有Autowired.Resource.Qualifier.S ...
- Spring 依赖注入,在Main方法中取得Spring控制的实例
Spring依赖注入机制,在Main方法中通过读取配置文件,获取Spring注入的bean实例.这种应用在实训的时候,老师曾经说过这种方法,而且学Spring入门的时候都会先学会使用如何在普通的jav ...
- Spring依赖注入 --- 简单使用说明
Spring依赖注入 --- 简单使用说明 本文将对spring依赖注入的使用做简单的说明,enjoy your time! 1.使用Spring提供的依赖注入 对spring依赖注入的实现方法感兴趣 ...
随机推荐
- C++ 二叉树深度优先遍历和广度优先遍历
二叉树的创建代码==>C++ 创建和遍历二叉树 深度优先遍历:是沿着树的深度遍历树的节点,尽可能深的搜索树的分支. //深度优先遍历二叉树void depthFirstSearch(Tree r ...
- 手机刷机软件与ROM的盈利模式分析
一. 智能手机的兴起不过短短几年时间,更新迭代已经让实体键盘成为回忆.智能手机带来的是人们生活习惯的改变,对于手机的重度依赖,是好是坏不去评价.智能手机相对于之前的手机最大的改变不仅仅是屏幕的飞速变大 ...
- JStrom的zk数据
/jstorm/masterlock 用于LeaderSelector的锁. /jstorm/master get /jstorm/master localhost.localdomain:7627 ...
- CIDR-Address介绍
CIDR是一种用二进制表示法来代替十进制表示法的新方法. IP地址有“类”的概念,/8掩码是A类,/16掩码是B类,/24掩码是C类等等.但是/12,/18,/25呢?这就是无类的概念了,CIDR的作 ...
- cannot access the system temp folder
cannot access the system temp folder. please, make sure your application have full control rights on ...
- jqGrid学习笔记(一)
3.2.body中的代码 <!-- jqGrid table list4 --> <table id="list4"></table> < ...
- 将Word发布到CSDN
将Word发布到CSDN 注:以Word2010为例 注册CSDN账号 打开Word新建一篇博客 打开"管理账户"新建一个账户,博客类别选择"其他" API选择 ...
- machine learning----->学习成绩
斯坦福大学机器学习公开课学习成绩:
- componentsSeparatedByString,componentsJoinedByString,componentsSeparatedByCharactersInSet
将string字符串转换为array数组 NSArray *array = [Str componentsSeparatedByString:@","]; ==反向方法 将arr ...
- UILabel的常用属性
UILabel常用属性1——实例化和设置文字 // 实例化UILabel并指定其边框 UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake ...