Dropwizard spring data couchbase - java

I am building a project with Dropwizard, Couchbase and ElasticSearch.
I am looking for a persistence layer like an ODM for Dropwizard and CouchBase. I looked over and found Spring-data-couchbase. Can I integrate DropWizard with Spring-data-couchbase and just use Spring-data-couchbase just for persistence? If I just use Spring-data-couchbase will it create an IOC container?

if you are looking for an ODM layer, we recently added a light one to the Java SDK, see Entity Mapping: http://blog.couchbase.com/javasdk-2.2-dp
Also if you are looking to use Spring Data Couchbase, you should maybe look into Spring boot, that basically does the same things as DropWizard. But of course Spring Data Couchbase is more integrated with Spring Boot than DropWizard.
As for DropWizard and Spring, yes I guess you would drag some Spring dependency in there so it might create some stuff that already have an equivalent in Dropwizard. But I have no knowledge of Dropwizard so, not sure.

Related

Spring data JPA WITHOUT an entire Spring Boot application

I am creating an internal CLI that is communicating with a PostgreSQL database and the easiness to create a no-code repository is one of the features that convince me to choose Spring data JPA.
However, I am not able to find some tutorial or GitHub repository to set up a Spring data JPA project without an entire spring boot application.
On the project https://github.com/spring-projects/spring-data-book/tree/master/jpa there is no main entry point, so the code is not runnable and by the way, it was updated 8 years ago ...
This other StackOverflow thread Spring Data JPA without Spring Boot does not help me because the guy could run his spring application on Google Cloud Platform finally (that was the cause of why he ask how to setup sping data jpa without spring boot).
I don't know how to start, if you have any ideas I will be happy to discuss with someone who is more experienced than me.
Thank you.
This might help if no more complete tutorial turns up https://docs.spring.io/spring-data/jpa/docs/1.5.0.RELEASE/reference/html/repositories.html
Look for this section
Standalone usage
You can also use the repository infrastructure outside of a Spring container, e.g. in CDI environments. You still need some Spring libraries in your classpath, but generally you can set up repositories programmatically as well. The Spring Data modules that provide repository support ship a persistence technology-specific RepositoryFactory that you can use as follows
In particular it says you can use a factory to generate repositories:
RepositoryFactorySupport factory = … // Instantiate factory here
UserRepository repository = factory.getRepository(UserRepository.class);
So adding the spring parts that contain the spring data classes may be enough for this level and if you want to have DI, too, you likely need to combine them with the respective spring dependencies and configure a regular spring application.

Is spring-data-redis compatible with Spring 3?

I have been looking all over the internet on how to configure Spring MVC 3 with redis but all in vain. I want to connect to redis using Spring MVC 3.
I have worked with spring boot and spring-data-redis and everything is working fine. I can connect to redis and store sessions. But the project I am currently working on is legacy based. It uses spring 3 but I believe spring-data-redis is compatible with spring 4 and above. Are there any alternates to make connection between spring 3 and redis. Any tutorial would be helpful.
I expect to store session data like username in the redis using Spring MVC 3
Well, from the documentation of the oldiest available spring-data-redis release
it looks like the minimal 2.x version is indeed spring 4
However, Spring data redis 1.x should work with spring 3.x:
https://docs.spring.io/spring-data/redis/docs/1.4.0.M1/reference/htmlsingle/#why-spring-redis
Having said that I haven't tried it by myself and if you're only storing sessions in redis, maybe using spring data is an overkill.
After all you can create a Jedis plugin by yourself, expose it as a bean and call the commands directly via the jedis driver. Its also possible to go with reactive client...

How to use ibatis in spring boot application using annotations?

I am using spring boot in my application, i want to know how to use Spring boot, iBatis and MySQL. While i am trying to find the reference for Spring boot with iBatis projects its automatically redirect to myBatis. I need a example project or site for referring this. I have example for mybatis but i want ibatis with spring boot.
I think, you shouldn't think how you may connect them. Just read docs about iBatis(MyBatis). But the following link special for you http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/

Memcached with Spring

I have a Spring based application that uses Spring core, Spring MVC and Spring Data (Mongo) on the server side, and designed as a typical 3-tier application.
I have a list of services, that are typical Spring services/beans that I wish you integrate with memcached to cache some of my service results.
Can someone guide me to the steps to integrate memcached with spring for such an application?
A sample/tutorial/blog that gives a step by step process would be just great.
Thanks.
If you use Spring 3.1 take a look at Spring Cache abstraction. It's the easiest way to integrate caching in Spring application. Unfortunately Spring doesn't support memcached out of the box, there's only support for ehcache.
As far as I know there isn't available any provider that can store data to memcached through Spring Cache. In few days next version 3.0.0 of Simple Spring Memcached is going to be released with such support. In mean time you may try one of the latest snapshot or use Simple Spring Memcached 2.0.0 directly without Spring Cache abstraction.
UPDATE: Simple Spring Memcached 3.0.0 with Spring Cache integration is already available.
It's very trivial to do. You can look at 3levelmemcache project as an example at github its Spring based abstraction.

Liferay spring integration

I try to use Spring to develop liferay portlets (version 6.0.6), could i use models and services generated by ServiceBuilder as spring bean?
I tried to import generated spring context in my own, but i got many errors in tomcat log. Maybe the best way is creation of own layer model and services using hibernate for example?
I would recommend that you go ahead and create your own service and persistence classes. Those have nothing to do with UI, so you can use them whether you plunge ahead with portal or not.
If you're using Spring already, and you're planning to move on to portal, you should be thinking about Spring portal. Now it's just the same as Spring web MVC, just with different controllers.

Categories

Resources