我是Spring JPA和Repository的新手.我有一个包含大量字段的Auction类,其中一个字段是category.我想在CrudRepository中使用自定义方法按Category.name过滤结果;
@XmlRootElement
@Entity(name="AUCTION")
public class Auction implements Serializable{
private static final long serialVersionUID = 1L;
@Id
String id;
@Column
@Size(min=5, max=200)
String title;
String description;
@OneToOne(cascade={CascadeType.ALL})
Category category;
....}
Run Code Online (Sandbox Code Playgroud)
类别
@Entity(name="CATEGORY")
//@NamedQuery(name="Category.findByName", query="select c from Category c where c.name=:name")
public class Category implements Serializable{
private static final long serialVersionUID = 3L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
private String name;
public Category()
{
}
Run Code Online (Sandbox Code Playgroud)
在拍卖存储库中,我添加了这样的方法
@Repository
public interface AuctionRepository extends CrudRepository<Auction, String>{
@Query("from Auction a join a.category c where c.name=:categoryName") …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个测试计划,其中根据采样器上的文本生成自定义报告.我无法在这三个级别中正确调整变量的范围.
loc = vars.get("local_count");
if(loc == null){
vars.put("local_count", "1");//available only in local thread level
}else{
temp = Integer.parseInt(loc) + 1;
vars.put("local_count", temp.toString());
}
log.info("the local count is " + vars.get("local_count");
glo = props.get("global_count");
if(glo == null){
props.put("global_count", "1");//available in test plan level
}else{
temp1 = Integer.parseInt(glo) + 1;
props.put("global_count", temp1.toString());
}
log.info("the global count is " + props.get("global_count");
Run Code Online (Sandbox Code Playgroud)
现在尝试创建多个Thread-Group并在每个中添加这个BeanShell采样器.
如何使变量仅在Thread-Group的所有线程中可用(而不是在其他线程组上).在不同的线程组中提供常量唯一名称不是一种选择.
有人能帮助我吗?提前致谢.
我正在尝试使用Facebook OAuth2.0配置Jasig CAS4.0.没有使用Facebook,默认用户名'casuser'和密码"Mellon"工作正常.我换了
<bean id="primaryAuthenticationHandler"
class="org.jasig.cas.authentication.AcceptUsersAuthenticationHandler">
<property name="users">
<map>
<entry key="casuser" value="Mellon"/>
</map>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
同
<bean id="primaryAuthenticationHandler" class="org.jasig.cas.support.pac4j.authentication.handler.support.ClientAuthenticationHandler">
<constructor-arg index="0" ref="clients"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
而id ="registeredServicesList"是
<util:list id="registeredServicesList">
<bean class="org.jasig.cas.services.RegexRegisteredService"
p:id="0" p:name="HTTP and IMAP"
p:description="Allows HTTP(S) and IMAP(S) protocols"
p:serviceId="^(https?|imaps?)://.*"
p:evaluationOrder="10000001"
p:enabled="true"
p:allowedToProxy="true"
p:ssoEnabled="true"
/>
Run Code Online (Sandbox Code Playgroud)
但是,在从facebook验证到我的CAS服务器然后再到我的应用程序后重定向后,我得到ticketValidationException.
type Exception report
message org.jasig.cas.client.validation.TicketValidationException:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org.jasig.cas.client.validation.TicketValidationException:
The supplied service 'https://rajan.com:2443/CasClientSimple/' is not authorized to use CAS proxy authentication.
org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:194) …Run Code Online (Sandbox Code Playgroud) 我用弹簧靴开发了一个应用程序,工作正常.有一个安静的控制器.我试图在某些页面添加spring security.其余控制器的端点是
/api/greetings
我在下面的课程中配置了安全设置.
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/home","/api/greetings").permitAll()
//.antMatchers("/api/greetings","").permitAll()//can't do this
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试从Rest-client(Postman)访问Rest端点时,只有GET方法可以访问,如果我尝试POST,PUT或DELETE,我将获得403 Forbidden响应.
{
"timestamp": 1467223888525,
"status": 403,
"error": "Forbidden",
"message": "Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'.",
"path": "/api/greetings/2"
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题.我是Spring Security的新手.
在JMeter中,我添加了oracle服务器的配置.然后我添加了一个JDBC请求对象并将ResultSet变量名称放入status.
测试执行正常,结果显示在treeview监听器中.
我想使用变量status并将其与字符串进行比较,但jmeter会抛出关于将arraylist转换为字符串的错误.
如何检索此变量并与While Controller中的字符串进行比较?