一. 1. As you can see, a bean factory performs several setup steps before a bean is ready touse. Let’s break down figure 1.5 in more detail:1 Spring instantiates the bean.2 Spring injects values and bean references into the bean’s properties.3 If the…
一.目标 要在BraveKnight调用embarkOnQuest()前后各做一些处理(调用Minstrel的方法) 二. 1.minstrel.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XM…
1.Spring’s fundamental mission: Spring simplifies Java development. 2.To back up its attack on Java complexity, Spring employs four key strategies:  Lightweight and minimally invasive development with POJO s Loose coupling through DI and interface…
一. 1. package chapter01.sia.knights.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import chapter01.sia.knights.BraveKnight; import chapter01.sia.knights.Knight; import chapter…
一. 1.knight.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sp…
1.把包含敏感信息的请求转为https请求,则较为安全,但如何只把有需要安全的请求转为https,而不是不加分辩就把所有请求都转为https呢?可以用requiresChannel() @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/spitter/me").hasRole("SPITTER&quo…
一. 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 access requirements. For example, here’s how you could use a SpEL expression to require ROLE_SPITTER…
一. 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 implement a custom implementationof the UserDetailsService interface. public interface UserDetailsService {…
一.LDAP server在哪 By default, Spring Security’s LDAP authentication assumes that the LDAP server is listening on port 33389 on localhost. But if your LDAP server is on another machine,you can use the contextSource() method to configure the location: @O…
一. 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 that if the passwords are stored in plain text, they’re subject to the prying eyes of a hacker. But if…