随笔分类 - Spring In Action 第4版笔记
摘要:一、JpaRepository 1.要使Spring自动生成实现类的步骤 (1)配置文件xml 或java (2)dao接口继承JpaRepository接口 2.为什么dao接口继承JpaRepository接口及设置好@EnableJpaRepositories后,Spring就会自动生成实现类
阅读全文
摘要:一、结构 二、Repository层 1. 2. 3. 4. 5. 6. 三、domain层 1. 2. 四、配置文件及数据库文件 1. 2. 3.RepositoryTest-context.xml 4.schema.sql 5.test-data.sql 6. 五、测试文件 1. 2.
阅读全文
摘要:一、结构 二、Repository层 1. 2. 3. 4. 三、domain层 1. 2. 四、配置文件及数据库文件 1. 2.RepositoryTest-context.xml 3.schema.sql 4.test-data.sql 5.log4j.properties 五、测试文件 1.
阅读全文
摘要:一、注入EntityManagerFactory的方式 这种方式有一个问题,Aside from presenting a troubling code-duplication situation, it also means a new EntityManager is created every
阅读全文
摘要:一、EntityManagerFactory的种类 1.The JPA specification defines two kinds of entity managers: Application-managed—Entity managers are created when an appl
阅读全文
摘要:一、结构 二、Repository层 1. 2. 3.以前是用HibernateTemplate,但现在的最佳实践是用Hibernate contextual sessions and not use HibernateTemplate at all. This can be done by wir
阅读全文
SPRING IN ACTION 第4版笔记-第十章Hitting the database with spring and jdbc-004-使用NamedParameterJdbcTemplate
摘要:为了使查询数据库时,可以使用命名参数,则要用NamedParameterJdbcTemplate 1.Java文件配置 2.在Dao层中使用
阅读全文
摘要:一、概述 1.Spring offers several options for configuring data-source beans in your Spring application, including these: Data sources that are defined by
阅读全文
摘要:0.结构 一、JDBC层 1. 2. 3. 4. 二、Domain层 1. 2. 三、配置文件及数据库文件 1.JdbcConfig.java 2.或用xml配置(JdbcRepositoryTests-context.xml) 3.schema.sql 4.test-data.sql 四、测试文件
阅读全文
摘要:1.spring扩展的jdbc异常 2.Template的运行机制 Spring separates the fixed and variable parts of the data-access process into two distinct classes: templates and ca
阅读全文
摘要:1.把包含敏感信息的请求转为https请求,则较为安全,但如何只把有需要安全的请求转为https,而不是不加分辩就把所有请求都转为https呢?可以用requiresChannel() Any time a request comes in for /spitter/form, Spring Sec
阅读全文
摘要:一、 What if you wanted to restrict access to certain roles only on Tuesday? Using the access() method, you can also use SpEL as a means for declaring a
阅读全文
摘要:一、 对特定的请求拦截 For example, consider the requests served by the Spittr application. Certainly, thehome page is public and doesn’t need to be secured. Lik
阅读全文
摘要:一、 1.定义接口 Suppose that you need to authenticate against users in a non-relational database suchas Mongo or Neo4j. In that case, you’ll need to impleme
阅读全文
摘要:一、LDAP server在哪 By default, Spring Security’s LDAP authentication assumes that the LDAP server is listening on port 33389 on localhost. But if your LD
阅读全文
摘要:一、 The default strategy for authenticating against LDAP is to perform a bind operation,authenticating the user directly to the LDAP server. Another op
阅读全文
摘要:一、 1.This method is the LDAP analog to jdbcAuthentication() 1 @Override 2 protected void configure(AuthenticationManagerBuilder auth) 3 throws Excepti
阅读全文
摘要:一、 1.Focusing on the authentication query, you can see that user passwords are expected to be stored in the database. The only problem with that is th
阅读全文
摘要:一、 1.It’s quite common for user data to be stored in a relational database, accessed via JDBC . To configure Spring Security to authenticate against a
阅读全文
摘要:Spring Security is extremely flexible and is capable of authenticating users against virtually any data store. Several common user store situations—su
阅读全文