随笔分类 -  Spring In Action 第4版笔记

摘要:一、JpaRepository 1.要使Spring自动生成实现类的步骤 (1)配置文件xml 或java (2)dao接口继承JpaRepository接口 2.为什么dao接口继承JpaRepository接口及设置好@EnableJpaRepositories后,Spring就会自动生成实现类 阅读全文
posted @ 2016-04-01 18:20 shamgod 阅读(311) 评论(0) 推荐(0)
摘要:一、结构 二、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. 阅读全文
posted @ 2016-04-01 16:47 shamgod 阅读(258) 评论(0) 推荐(0)
摘要:一、结构 二、Repository层 1. 2. 3. 4. 三、domain层 1. 2. 四、配置文件及数据库文件 1. 2.RepositoryTest-context.xml 3.schema.sql 4.test-data.sql 5.log4j.properties 五、测试文件 1. 阅读全文
posted @ 2016-04-01 16:39 shamgod 阅读(195) 评论(0) 推荐(0)
摘要:一、注入EntityManagerFactory的方式 这种方式有一个问题,Aside from presenting a troubling code-duplication situation, it also means a new EntityManager is created every 阅读全文
posted @ 2016-04-01 13:59 shamgod 阅读(445) 评论(0) 推荐(0)
摘要:一、EntityManagerFactory的种类 1.The JPA specification defines two kinds of entity managers:  Application-managed—Entity managers are created when an appl 阅读全文
posted @ 2016-04-01 13:29 shamgod 阅读(436) 评论(0) 推荐(0)
摘要:一、结构 二、Repository层 1. 2. 3.以前是用HibernateTemplate,但现在的最佳实践是用Hibernate contextual sessions and not use HibernateTemplate at all. This can be done by wir 阅读全文
posted @ 2016-04-01 13:09 shamgod 阅读(1830) 评论(0) 推荐(0)
摘要:为了使查询数据库时,可以使用命名参数,则要用NamedParameterJdbcTemplate 1.Java文件配置 2.在Dao层中使用 阅读全文
posted @ 2016-03-31 23:27 shamgod 阅读(238) 评论(0) 推荐(0)
摘要:一、概述 1.Spring offers several options for configuring data-source beans in your Spring application, including these:  Data sources that are defined by 阅读全文
posted @ 2016-03-31 18:45 shamgod 阅读(358) 评论(0) 推荐(0)
摘要:0.结构 一、JDBC层 1. 2. 3. 4. 二、Domain层 1. 2. 三、配置文件及数据库文件 1.JdbcConfig.java 2.或用xml配置(JdbcRepositoryTests-context.xml) 3.schema.sql 4.test-data.sql 四、测试文件 阅读全文
posted @ 2016-03-31 18:21 shamgod 阅读(348) 评论(0) 推荐(0)
摘要:1.spring扩展的jdbc异常 2.Template的运行机制 Spring separates the fixed and variable parts of the data-access process into two distinct classes: templates and ca 阅读全文
posted @ 2016-03-31 18:07 shamgod 阅读(196) 评论(0) 推荐(0)
摘要:1.把包含敏感信息的请求转为https请求,则较为安全,但如何只把有需要安全的请求转为https,而不是不加分辩就把所有请求都转为https呢?可以用requiresChannel() Any time a request comes in for /spitter/form, Spring Sec 阅读全文
posted @ 2016-03-31 15:13 shamgod 阅读(795) 评论(0) 推荐(0)
摘要:一、 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 阅读全文
posted @ 2016-03-08 11:39 shamgod 阅读(193) 评论(0) 推荐(0)
摘要:一、 对特定的请求拦截 For example, consider the requests served by the Spittr application. Certainly, thehome page is public and doesn’t need to be secured. Lik 阅读全文
posted @ 2016-03-08 11:17 shamgod 阅读(397) 评论(0) 推荐(0)
摘要:一、 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 阅读全文
posted @ 2016-03-08 10:19 shamgod 阅读(340) 评论(0) 推荐(0)
摘要:一、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 阅读全文
posted @ 2016-03-08 10:01 shamgod 阅读(303) 评论(0) 推荐(0)
摘要:一、 The default strategy for authenticating against LDAP is to perform a bind operation,authenticating the user directly to the LDAP server. Another op 阅读全文
posted @ 2016-03-08 09:44 shamgod 阅读(655) 评论(0) 推荐(0)
摘要:一、 1.This method is the LDAP analog to jdbcAuthentication() 1 @Override 2 protected void configure(AuthenticationManagerBuilder auth) 3 throws Excepti 阅读全文
posted @ 2016-03-07 13:21 shamgod 阅读(285) 评论(0) 推荐(0)
摘要:一、 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 阅读全文
posted @ 2016-03-07 12:35 shamgod 阅读(285) 评论(0) 推荐(0)
摘要:一、 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 阅读全文
posted @ 2016-03-07 12:24 shamgod 阅读(254) 评论(0) 推荐(0)
摘要:Spring Security is extremely flexible and is capable of authenticating users against virtually any data store. Several common user store situations—su 阅读全文
posted @ 2016-03-07 12:05 shamgod 阅读(508) 评论(0) 推荐(0)

haha