Hello, I like to extend CAS login flow, using CAS5 overlay template with my customized authenticator (it does database lookup), but having trouble getting Spring Data Repository work.
I added the following class in cas5-overlay. I am using jndi data source lookup. The JNDI data source is defined on tomcat8. I also defined Spring data repository. The error is when Spring IoC tries to inject my data repository, it throws NoSuchBeanDefinitionException. Any suggestions? Thx! Yan === Configuration === @Configuration @EnableJpaRepositories @EnableTransactionManagement public class QuestCASApplicationContext { @Bean(destroyMethod="") public DataSource dataSource() { try { JndiObjectFactoryBean bean = new JndiObjectFactoryBean(); bean.setJndiName("java:comp/env/jdbc/cas5DS"); bean.setProxyInterface(DataSource.class); bean.setLookupOnStartup(false); bean.afterPropertiesSet(); return (DataSource)bean.getObject(); } catch (NamingException ex) { throw new RuntimeException(ex); } } @Bean public EntityManagerFactory entityManagerFactory() { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setGenerateDdl(true); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan("com.quest.hub.cas.model"); factory.setDataSource(dataSource()); factory.afterPropertiesSet(); return factory.getObject(); } @Bean public PlatformTransactionManager transactionManager() { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setEntityManagerFactory(entityManagerFactory()); return txManager; } } === Repository === @Repository public interface LoginUserRepository extends CrudRepository<LoginUser, Long> { @Query(value = "select * from CAS_USER b where lower(login_name) = lower(?1)", nativeQuery = true) public List<LoginUser> findByLoginNameIgnoreCase(String loginName); } ==== Configuration for my CAS authenticator === @Configuration("casCredentialConfiguration") @EnableConfigurationProperties(CasConfigurationProperties.class) public class CASCredentialConfiguration { @Autowired private LoginUserRepository userRepository; <=== Spring throws NoSuchBeanDefinitionException -- - CAS gitter chatroom: https://gitter.im/apereo/cas - CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html - CAS documentation website: https://apereo.github.io/cas - CAS project website: https://github.com/apereo/cas --- 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 cas-user+unsubscr...@apereo.org. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/a2835e0e-1dfb-4610-beb2-4a97f9a42ebb%40apereo.org.