Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:48:57+00:00 2026-05-27T17:48:57+00:00

I try to implement using Spring 3.1.0.RELEASE + Hibernate to make RESTful web service

  • 0

I try to implement using Spring 3.1.0.RELEASE + Hibernate to make RESTful web service followed this guy’s project https://github.com/eugenp/REST

when I run my project is contain error like this.

SEVERE: Context initialization failed
*.BeanCreationException: Error creating bean with name 'userServiceController': Injection of autowired dependencies failed;
*.BeanCreationException: Error creating bean with name 'defaultUserService': Injection of autowired dependencies failed;
*.BeanCreationException: Could not autowire field: private com.cloudlb.dao.UserDAO com.cloudlb.service.DefaultUserService.userDao;
*.NoSuchBeanDefinitionException: No matching bean of type [com.cloudlb.dao.UserDAO]

This is my configuration: (persistence.properties)

ApplicationConfig:

@Configuration
@ComponentScan(basePackages = "com.cloudlb", excludeFilters = { @ComponentScan.Filter(Configuration.class)})
public class ApplicationConfig {

    @Bean
    public static PropertyPlaceholderConfigurer properties() {
        final PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
        final Resource[] resources = new ClassPathResource[]{new ClassPathResource("persistence.properties"), new ClassPathResource("restful.properties")};
        ppc.setLocations(resources);
        ppc.setIgnoreUnresolvablePlaceholders(true);
        return ppc;
    }

In PersistenceHibernateConfig contain like this:

@Profile("hibernate")
@EnableTransactionManagement
public class PersistenceHibernateConfig { ...

    @Bean
    public LocalSessionFactoryBean alertsSessionFactoryBean() { ...

    @Bean
    public DataSource restDataSource() { ...

    @Bean
    public HibernateTransactionManager transactionManager() { ...

WebConfig:

@Configuration
@EnableWebMvc
public class WebConfig { ... }

So, it start get an error in autowired from here:

UserServiceController:

@Controller
public class UserServiceController {

    @Autowired
    private UserService userService;

UserService which is implemented by DefaultUserService:

@Service
@Transactional(propagation = Propagation.REQUIRED)
public class DefaultUserService implements UserService {

    @Autowired
    private UserDAO userDao;

UserDAO:

public interface UserDAO extends GenericDAO<User> {  ... }

UserHibernateDAO:

@Profile("hibernate")
public class UserHibernateDAO extends GenericHibernateDAO<User> implements UserDAO{ ... }

GenericHibernateDAO:

@Profile("hibernate")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class GenericHibernateDAO<T extends Serializable> extends AbstractHibernateDAO<T> implements GenericDAO<T> { ... }

And last one AbstractHibernateDAO:

@Transactional( propagation = Propagation.SUPPORTS )
public abstract class AbstractHibernateDAO<T extends Serializable> implements DAO<T> {

    private Class<T> clazz;

    @Autowired
    private SessionFactory sessionFactory;

    public AbstractHibernateDAO() {
        super();
    }

    public final void setClazz(final Class<T> clazz) {
        this.clazz = clazz;
    }

    @Override
    @Transactional( readOnly = true )
    public T findById(String id) {
        return (T) this.getCurrentSession().get(this.clazz, id);
    }

    protected Session getCurrentSession() {
        return this.sessionFactory.getCurrentSession();
    }
}

I thought it could find UserHibernateDAO. May be I missing something here. So, hope someone know how to fix it. I struck at this problem for 2 day.

I guess there could be a problem in SessionFactory too. Because I start to fix that thing and this came up.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:48:57+00:00Added an answer on May 27, 2026 at 5:48 pm

    In addition to @Profile("hibernate") the UserHibernateDAO needs an annotation declaring it a Spring bean like @Named or @Component.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've try to implement integration tests for a working application (spring, hibernate, soap, cxf).
Using Hibernate 3.6.8.Final and Spring 3.0.5.RELEASE , I'm trying to add some Common DAO
I using JSF 2.0 + Icefaces 2.0 and try to implement spring security 2.06
If I try to implement my class on this file I get an error
If I try to implement this simple-as-possible example: Update Content with AJAXRefreshRequest it does
I am trying to implement a test project using the Point Cloud Library and
Is it possible to create a web service operation using primitive or basic Java
Im using Awesomium to try and implement webpages inside my windows form application. I've
I am using declarative transactions in Spring. I have a service layer which is
I have A WCF service that has a class that inherits System.Web.Security.RoleProvider. In this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.