This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public DispatcherServlet dispatcherServlet() { | |
return new DispatcherServlet(); | |
} | |
@Bean | |
public ServletRegistrationBean dispatchcherServletRegistration(){ | |
ServletRegistrationBean registrationBean =new ServletRegistrationBean(dispatcherServlet(), "/rest/v1/*"); | |
registrationBean | |
.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public CustomFilter customFilter(){ | |
return new CustomFilter(); | |
} | |
@Bean | |
public FilterRegistrationBean customFilterRegistration(){ | |
FilterRegistrationBean customFilterRegistration=new FilterRegistrationBean(metricsFilter(), dispatcherServletRegistration()); | |
return customFilterRegistration; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NoRepositoryBean | |
public interface MyRepository<T, ID extends Serializable> extends TypedIdCassandraRepository<T, ID> { | |
<S extends T> S save(S s, int ttl); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NoRepositoryBean | |
public class MyRepositoryImpl<lT, ID extends Serializable> extends SimpleCassandraRepository<T, ID> implements MyRepository<T, ID> { | |
public MyRepositoryImpl(CassandraEntityInformation<T, ID> metadata, CassandraTemplate template) { | |
super(metadata, template); | |
this.entityInformation = metadata; | |
this.template = template; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> extends RepositoryFactoryBeanSupport<T, S, ID> { | |
@Autowired | |
private CassandraTemplate cassandraTemplate; | |
@Override | |
protected RepositoryFactorySupport createRepositoryFactory() { | |
return new MyRepositoryFactory(cassandraTemplate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableCassandraRepositories( repositoryFactoryBeanClass = MyRepositoryFactoryBean.class) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SampleRepository extends MyRepository<Sample, String> { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autoriwed | |
SampleRepository sampleRepository; | |
.... | |
public void useSampleRepository(...) { | |
.... | |
sampleRepository.save(sample, ttl); |