Hello,

I am about to give up, and stay with jdbcTemplate.  I am unable to get 
Spring JPA Data Repository to work with CAS 6.4 snapshot.

This is my CasWebApplication, everything about data repository is enabled. 
But there is no indication in logs that data-jpa autoConfiguration is 
taking place. 

@SpringBootApplication(
scanBasePackages  = {"org.apereo.cas", "com.quest.cas"}, 
exclude = {
    GroovyTemplateAutoConfiguration.class
}, 
proxyBeanMethods = false)
@EnableJpaRepositories(basePackages = {"com.quest.cas.prs.model"})
@EntityScan(basePackages =  {"com.quest.cas.prs.model"})
@EnableConfigurationProperties(CasConfigurationProperties.class)
@EnableAsync
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableTransactionManagement(proxyTargetClass = true)
@EnableScheduling
@NoArgsConstructor
@Slf4j
public class CasWebApplication {
    

There must be something preventing Data repository running, see below for 
some conditions from Spring,  I think my runtime environment should allow 
it to run, but it does not. 

@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(DataSource.class)
@ConditionalOnClass(JpaRepository.class)
@ConditionalOnMissingBean({ JpaRepositoryFactoryBean.class, 
JpaRepositoryConfigExtension.class })
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = 
"enabled", havingValue = "true",
matchIfMissing = true)
@Import(JpaRepositoriesRegistrar.class)
@AutoConfigureAfter({ HibernateJpaAutoConfiguration.class, 
TaskExecutionAutoConfiguration.class })
public class JpaRepositoriesAutoConfiguration {

Yan


On Wednesday, May 12, 2021 at 2:33:07 PM UTC-4 Pablo Vidaurri wrote:

> Having same problem with the autowire of the repository annotated class. 
> Any help would be appreciated.
>
> -psv
>
> On Tuesday, May 11, 2021 at 8:43:05 AM UTC-5 Yan Zhou wrote:
>
>> Hello,
>>
>> CAS uses Spring JdbcTemplate, it does not use Spring JPA Data Repository. 
>> I was able to easily add that in CAS 5.3, but run into difficulty with CAS 
>> 6.3.
>>
>> The Spring JPA Data Repository allows me to define interface and Spring 
>> provides beans that implement them and Spring cares for all the injection.  
>>  In Cas 6.3, I keep getting error: NoSuchBeanDefinition, in other words, 
>> Spring did not instantiate beans for repository interfaces as it should. 
>>
>> I believe all my Spring Data Repository configuration is correct and that 
>> is why it is working in CAS5.3, such as the spring-data-jpa dependencies, 
>> specifying packages for @EnableJpaRepository, @EntityScan in a 
>> @Configuration class. 
>>
>> Here is CAS 5.3. I can see Spring is instantiating beans for repository 
>> interfaces, but this is not happening in CAS 6.3
>>
>> Did the wiring and bean instantiation change in cas 6.3?
>>
>> Thanks,
>> Yan
>>
>> 2021-05-11 02:00:29,041 DEBUG 
>> [org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
>> <Pre-instantiating singletons in 
>> org.springframework.beans.factory.support.DefaultListableBeanFactory@66345a4f:
>>  
>> defining beans  ............. (some of them are the JPA Data Repository 
>> beans)
>>
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/c8d25643-164d-4117-8105-35d3df8f438fn%40apereo.org.

Reply via email to