spring-data

SpringCacheBasedUserCache is null

梦想与她 提交于 2021-01-28 22:22:32
问题 I have web applicatoin who use spring boot, spring security and spring data. it is stateless. I would like to avoid to alway call db for user acess. So i thinking using SpringCacheBasedUserCache. @Configuration @EnableCaching public class CacheConfig { @Bean CacheManager cacheManager() { SimpleCacheManager cacheManager = new SimpleCacheManager(); cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache("city"), new ConcurrentMapCache("userCache"))); return cacheManager; } @Bean public

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table user"

这一生的挚爱 提交于 2021-01-28 09:58:52
问题 I am new to Cassandra and this has been giving me issues. I downloaded apache-Cassandra 3.11 and I am using spring boot 1.5.4.RELEASE. I did some research and found a source where it says it may be because Spring data is using a different Cassandra driver core version? But the latest uses cql 3 correct? I also made a java class configuration file. The issue may be here. import org.springframework.cassandra.config.CassandraCqlClusterFactoryBean; import org.springframework.cassandra.config

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table user"

与世无争的帅哥 提交于 2021-01-28 09:55:13
问题 I am new to Cassandra and this has been giving me issues. I downloaded apache-Cassandra 3.11 and I am using spring boot 1.5.4.RELEASE. I did some research and found a source where it says it may be because Spring data is using a different Cassandra driver core version? But the latest uses cql 3 correct? I also made a java class configuration file. The issue may be here. import org.springframework.cassandra.config.CassandraCqlClusterFactoryBean; import org.springframework.cassandra.config

Spring Ldap get roles/authorities from user

喜夏-厌秋 提交于 2021-01-28 06:08:55
问题 i am trying to get the roles from a user in our ldap system. First of all, my ldap user entry and role entry: @Data @Entry(objectClasses = {"inetOrgPerson", "top"}, base = "ou=people" public class LdapUserEntry { @Id private Name id; @DnAttribute(value = "uid") private String username; @Attribute(name = "cn") private String cn; @Attribute(name = "userPassword") private String password; @DnAttribute(value = "ou") @Transient private String group; } Role Entry class: @Data @Entry(objectClasses =

How do I connect to AWS RDS MySQL from Java/Spring application using AWS IAM Authentication?

对着背影说爱祢 提交于 2021-01-28 06:05:49
问题 I am new to AWS world and still learning. It's been only a month that I am trying things. I have been looking for it for quite a few days now and haven't been able to find a correct and more appropriate solution. Therefore it would be great if somebody can help me by giving a sample code, provide some pointer or guide in the right direction. I have a AWS RDS MySQL instance and a database created. I have configured " IAM DB AUthentication Enabled " to "Yes". Created an IAM Role and Policy as

Spring-Mongo-Data Update only allows one positional argument?

淺唱寂寞╮ 提交于 2021-01-28 05:17:38
问题 I have a data model with the following structure: { _id: ObjectId(''), strs: [ { _id: ObjectId(''), nds: [ { _id: ObjectId(''), title: '' }, . . . ] }, . . . ] } Following query works perfectly fine in mongo shell: mongo.update({_id: ObjectId(''), 'strs._id': ObjectId(''), 'strs.nds._id': ObjectId('')}, {$set: {'strs.$.nds.$.title': 'new-title'}}) I am trying to do the same in Spring Boot, I have written the following lines of code: Criteria criteria = new Criteria(); criteria.addOperator

Spring @Transactional does not rollback checked exceptions

时光毁灭记忆、已成空白 提交于 2021-01-28 05:13:00
问题 I have been stuck for a while to make Spring rollback a transaction when a checked exception is thrown using @Transactional(rollbackFor) . Here is my code: The data access class: @Repository public class CustomerDao { @Autowired private SessionFactory sessionFactory; public void willRollback() throws CheckedException { sessionFactory.getCurrentSession().persist(new SpringCustomer(null, "roll back")); throw new CheckedException(); } } Where CheckedException is just a simple checked exception:

Use Spring Data random (embedded) Mongo port with NoSQL JUnit @Rule

天涯浪子 提交于 2021-01-28 04:15:59
问题 I'm currently trying to write an Integration test class which uses Spring Data Mongo repositories. I use an embedded Mongo instance provided by the de.flapdoodle.embed.mongo dependency. Spring Data documentation specifies that we only have to put this dependency in the project and the EmbedMongoAutoConfiguration takes care of the rest. For now, that's ok, and setting the port to 0 makes the auto configuration process to find a free port to launch the mongo instance on. This feature is

Could not open JPA EntityManager for transaction, using persistence.xml in spring and hibernate

风流意气都作罢 提交于 2021-01-28 03:18:17
问题 I am getting the error that my EntityManager could not be opened: nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.NullPointerException root cause org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.NullPointerException root cause java.lang.NullPointerException applicationContext.xml:

MongoDb Spring find in nested object

你。 提交于 2021-01-28 02:00:59
问题 I'm using Spring Data Mongodb and documents like this : { "_id" : ObjectId("565c5ed433a140520cdedd7f"), "attributes" : { "565c5ed433a140520cdedd73" : "333563851" }, "listId" : ObjectId("565c57aaf316d71fd4e4d0a0"), "international" : false, "countryCode" : 33, "deleted" : false } I would like to query my collection to search a value in the attributes object (in the values and not the keys). For example like this : @Query("{'listId': ?0, $or: [{'attributes.*':{$regex: ?1}}], 'deleted':false}")