facebook

spring autowired problem

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #350510 Reply

    Andrew Cheng
    Participant

    use notation instead of applicationContext.xml


    @Service
    (value = “fixedDepositService”)
    //@Service
    public class FixedDepositServiceImpl implements FixedDepositService {
    @Autowired
    private FixedDepositDao fixedDepositDao;

    @Override

    log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    Jul 21, 2014 1:34:10 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet ‘bankapp’
    Jul 21, 2014 1:34:10 AM org.apache.catalina.core.ApplicationContext log
    SEVERE: StandardWrapper.Throwable
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘fixedDepositController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private sample.spring.chapter11.service.FixedDepositService sample.spring.chapter11.web.FixedDepositController.fixedDepositService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [sample.spring.chapter11.service.FixedDepositService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.spr

    at java.lang.Thread.run(Thread.java:744)
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private sample.spring.chapter11.service.FixedDepositService sample.spring.chapter11.web.FixedDepositController.fixedDepositService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [sample.spring.chapter11.service.FixedDepositService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
    … 29 more
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [sample.spring.chapter11.service.FixedDepositService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
    at

    #350511 Reply
    #350522 Reply

    Andrew Cheng
    Participant

    Do you have any spring autowired annotation example that work?
    so that I can compare . Any way, a workable for myeclipse.
    The sample( from the book) I have suppose to be work, but not for myeclipse 2015

    #350535 Reply

    ayc868,

    I’m afraid MyEclipse doesn’t provide any tutorials for spring @Autowired annotation. For your convenience I have pasted some tutorial links here –
    http://www.dineshonjava.com/2012/07/spring-autowired-annotation.html#.U84uSvmSzHI
    http://www.tutorialspoint.com/spring/spring_autowired_annotation.htm

    Let us know if you see any issues in MyEclipse.

    #350567 Reply

    Andrew Cheng
    Participant

    I have a lot resources.
    But the problem is,

    it must be a web application. My problem is the deployment to Tomcat with MyEclipse –
    combination problem. Tomcat loading problem

    #350572 Reply

    ayc868,

    My problem is the deployment to Tomcat with MyEclipse –
    combination problem. Tomcat loading problem

    1. Can you please be more clear on what exact problem you are facing ? Please mention the exact steps to help us replicate the issue at our end.

    2. Can you please clarify on which Tomcat server you are facing the problem ? Is it with MyEclipse embedded Tomcat server or external Tomcat server ? Also mention the tomcat version you are using?

    3. Is the issue only with a particular project or all the projects ?

    4. Clear the contents of the .log file which is located at <workspace dir>/.metadata/.log, now try deploying the project. Please paste the entire contents of the .log file here to help us investigate further.

    #350598 Reply

    Andrew Cheng
    Participant

    This is trick. it take me long time to resolve all this.

    #350687 Reply

    ayc868,

    Can you please clarify whether you could fix the Tomcat deployment issue ? If yes, can you please let us know what changes have you done to make it work ?

    If you are still facing the problem, Can you please provide the details that I have asked in my earlier response ?

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: spring autowired problem

You must be logged in to post in the forum log in