我正在使用 JPA 1.0,所以我能做的事情受到限制,但我仍然认为应该可以执行以下操作,但我无法让它工作......
Table CustomerA
a_id
Table ProductB
a_id
b_id
Table ProductC
a_id
c_id
@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class AbstractProduct {
@Id
@GeneratedValue....
private Long id;
private String name;
@ManyToOne()
JoinColumn(name="a_id")
private CustomerA customerA;
}
Run Code Online (Sandbox Code Playgroud)
现在我想创建一个子类,它可以覆盖Id
或创建基于派生表的PK
键Table A
和键的复合键...
@Entity
@Table(name="ProductB")
public class ProductB extends AbstractProduct {
//@AttributeOverride(name="id", column=@Column(name="B_ID") //Can only be used with MappedSuperClass and also Emmbedded Objects
//@Id //cant override the ID Column so that cant go here
//PrimaryKeycolumn join not what i want …
Run Code Online (Sandbox Code Playgroud) 我想通过自定义控制器和登录页面更好地控制登录和注销。
我的 SecurityConfiguration 代码目前如下所示:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private SpringDataJpaUserDetailsService userDetailsService;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(this.userDetailsService)
.passwordEncoder(Manager.PASSWORD_ENCODER);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/resources/**", "/built/**", "/main.css", "/login.css").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.loginProcessingUrl("/loginSecure")
.defaultSuccessUrl("/index", true)
.permitAll()
.usernameParameter("username").passwordParameter("password")
.and()
.csrf().disable()
.logout()
.permitAll();
}
}
Run Code Online (Sandbox Code Playgroud)
我的控制器中的登录配置:
@RequestMapping(value = "/login")
public String login() {
return "login";
}
Run Code Online (Sandbox Code Playgroud)
我的控制器中的 loginSecure 映射:
@RequestMapping(value="/loginSecure", method = RequestMethod.POST)
public String …
Run Code Online (Sandbox Code Playgroud) 我正在从 jetty 8 升级到 jetty 9,并且在某些 API 中遇到了一些有关编译失败的问题。
SslSelectChannelConnector 已被删除,从我可以看到带有 secureRequestCustomizer 的 httpConfiguration 替换了它。
但是有很多方法我都找不到。例如
设置请求缓冲区大小
设置响应缓冲区大小
设置接受者
设置最大空闲时间
SessionHandler 不再有 getSessionManager() 方法。
另外 queueThreadPool 不再有 setMaxQueued(int),JettyServer 不再有这两个方法: setThreadPool(QueueThreadPool) setGracefulShutdown(int)
编辑: SslSelectChannelConnector 已弃用。将 SelectChannelConnector 与 SslContextFactory 一起使用。
jettyServer.setThreadPool(threadPool); // --> threadPool is set in the constructor new Server(QueueThreadPool)
jettyServer.setGracefulShutdown(5000); // --> jettyServer.setStopTimeout(5000);
jettyServer.setConnectors(new Connector[] { connector }); // --> ServerConnector which takes https_config
jettyServer.setSendServerVersion(false); // --> https_config.setSendServerVersion(false);
Run Code Online (Sandbox Code Playgroud)
哪里或哪个 API 用于代替上述 API?
还有任何自定义的东西在运行时停止工作,这不是很明显可以找到/看到。