only after refactoring packages names, Consider defining a bean of type * in your configuration

Amine Ben Mansour :

this piece of code has been working perfectly, i just refactored packages names and the spring context can no more inject this bean. I am sure btw that the new packages names still matches the @ComponentScan scope

@Repository("tenantsConfigRepository")
public interface TenantsConfigRepository extends JpaRepository<TenantsConfig, Long> {
    public TenantsConfig deleteByName(String name);
}
@Service
public class TenantsConfigService {

    TenantsConfigRepository tenantsConfigRepository;


    @Autowired
    public TenantsConfigService(TenantsConfigRepository tenantsConfigRepository) {
        this.tenantsConfigRepository = tenantsConfigRepository;
    }

    public List<TenantsConfig> findAll() {
        return tenantsConfigRepository.findAll();
    }

    public Optional<TenantsConfig> find(long id) {
        return tenantsConfigRepository.findById(id);
    }

    public void saveOrUpdate(TenantsConfig tenantsConfig) {
        tenantsConfigRepository.save(tenantsConfig);
    }

    public void delete(TenantsConfig tenantsConfig) {
        tenantsConfigRepository.delete(tenantsConfig);
    }

    public void deleteByName(String name) {
        tenantsConfigRepository.deleteByName(name);
    }
}

Application failed to start and printing this text

***************************
APPLICATION FAILED TO START
**************************

Description:

Parameter 0 of constructor in com.example.admin.service.TenantsConfigService required a bean named 'entityManagerFactory' that could not be found.


Action:

Consider defining a bean named 'entityManagerFactory' in your configuration.
Amine Ben Mansour :

thanks guys for responding, I figured it out, i was using a datasource from a configuration class, those configurations were scoped to be used to specific packages, i just changed thebasePackages attribute to match the new packages names.

@Configuration
@EnableJpaRepositories(basePackages = "com.example.admin", entityManagerFactoryRef = "adminEntityManager", transactionManagerRef = "adminTransactionManager")

and

em.setPackagesToScan("com.example.admin.entity");

em refers to EntityManager

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Consider defining a bean of type * in your configuration

Consider defining a bean of type in your configuration

Consider defining a bean of type 'UserConverter' in your configuration

Consider defining a bean of type 'package' in your configuration [Spring-Boot]

Consider defining a bean of type 'service' in your configuration [Spring boot]

Consider defining a bean of type 'javax.servlet.ServletContext' in your configuration

APPLICATION FAILED TO START - Consider defining a bean of type in your configuration [SpringBoot]

Consider defining a bean of type 'org.modelmapper.ModelMapper' in your configuration

Consider defining a bean of type 'int' in your configuration[SpringBoot]

How to fix "Consider defining a bean of type 'org.jooq.DSLContext' in your configuration." after update to jOOQ 3.15.0

Field in required a bean of type that could not be found consider defining a bean of type in your configuration

Consider defining a bean of type 'io.ipl.amaresh.data.JobCompletionNotificationListener' in your configuration. The bean could not be found in that

Spring Boot - Injecting Repository into Controller throws Consider defining a bean of type 'Type' in your configuration

Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis.core.RedisTemplate' in your configuration

Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration

SpringBootTest - Consider defining a bean of type 'java.lang.String' in your configuration

Consider defining a bean of type '[3rd party dependency]' in your configuration

Consider defining a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' in your configuration

Consider defining a bean of type 'com.ensat.services.ProductService' in your configuration

Consider defining a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' in your configuration

Redis Issue Consider defining a bean of type 'org.springframework.data.redis.core.HashOperations' in your configuration

Consider defining a bean of type 'com.gisapp.gisapp.dao.IUserDAO' in your configuration

How do i resolve Consider defining a bean of type 'java.lang.String' in your configuration?

How to fix this issue "Consider defining a bean of type 'repository.InterfaceName' in your configuration."

Consider defining a bean of type 'com.example.conferencedemo.services.SessionService' in your configuration

Spring Boot: Consider defining a bean named 'entityManagerFactory' in your configuration

Consider defining a bean of type 'redis.clients.jedis.JedisPool' in your configuration. error while integrating Redis Jedis

Consider defining bean of type authentication manager

Consider defining a bean of type 'org.flywaydb.core.Flyway'