Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

619
Views
No qualifying bean of type 'javax.persistence.EntityManager' available: expected at least 1 bean which qualifies as autowire candidate

I have this problem...

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.persistence.EntityManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

I don't usually boot. these are configurations:

@Configuration
@EnableTransactionManagement
public class SpringOrmConfig {

    private final DataSource dataSource;

@Autowired
public SpringOrmConfig(@Qualifier("dataSource") DataSource dataSource) {
    this.dataSource = dataSource;
}

@Bean
public LocalContainerEntityManagerFactoryBean factoryBean(@Autowired Properties jpaProperties) {
    LocalContainerEntityManagerFactoryBean emFactoryBean = new LocalContainerEntityManagerFactoryBean();
    emFactoryBean.setDataSource(dataSource);
    emFactoryBean.setPersistenceUnitName("jpa-unit");
    emFactoryBean.setPersistenceUnitName("localContainerEntityManagerFactoryBean");
    emFactoryBean.setPersistenceUnitName("factoryBean");
    emFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    emFactoryBean.setPackagesToScan("my.package");
    emFactoryBean.setJpaProperties(jpaProperties);
    return emFactoryBean;
}
...

The problem occurs in this class

@Repository
public class MyRepoSpringOrmImpl extends AbstractSpringOrm<Group> implements MyRepo {

    @Autowired
    protected MyRepoSpringOrmImpl(EntityManager em) {
        super(em, My.class);
    }
...

configuration

@ComponentScan("my.package")
@PropertySource("classpath:db_config.properties")
@EnableWebMvc
@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableTransactionManagement
public class ApplicationConfig implements WebMvcConfigurer {

    @Value("${driver}")
    String driver;
    @Value("${url}")
    String url;
    @Value("${login}")
    String login;
    @Value("${password}")
    String password;


    @Bean
    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClass(driver);
        dataSource.setJdbcUrl(url);
        dataSource.setUser(login);
        dataSource.setPassword(password);
        return dataSource;
    }

I do not understand what's the matter... Help please

p.s. I deliberately didn't use Spring Boot because it's not allowed in my project

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!