如何在运行选择查询时为现有表生成行号?
例如:
select row_number(), * from emp;
Run Code Online (Sandbox Code Playgroud)
我正在使用hive 0.13.我无法在我的环境中访问外部jar或udfs.底层文件采用镶木地板格式.
提前致谢!
我正在尝试配置 Spring Security 并收到以下错误:
引起:java.lang.IllegalStateException:在anyRequest之后无法配置antMatchers
这是我的SecurityConfig课:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter{
@Autowired
private UserDetailsService userDetailsService;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(encodePWD());
}
@Override
protected void configure(HttpSecurity http) throws Exception{
http
.csrf().disable();
http
.httpBasic()
.and()
.authorizeRequests()
.antMatchers("/rest/**").permitAll()
.anyRequest().authenticated()
.and()
.authorizeRequests()
.antMatchers("/secure/**").hasAnyRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.permitAll();
http
.authorizeRequests()
.antMatchers("/login").permitAll();
}
@Bean
public …Run Code Online (Sandbox Code Playgroud) 我正在使用JBOSS AS7.1,Eclipse Luna进行开发.我的eclipse安装确实为maven安装了一个插件.
我使用maven命令行创建了我的webapp项目.
在我目前的设置中,我必须mvn clean install每次都使用所有更改来构建我的maven项目,即使对于HTML,CSS这样的静态文件也是如此.
然后,我必须使用运行的JBOSS控制台部署生成的WAR文件http://localhost:9990/console.
我很确定必须有另一种方法来做到这一点.当然,它确实需要花费很多时间.
请引导我采用我可以采用的方法来加快开发速度.
我正在将数百万条记录摄取到 Elasticsearch 中,并从 Elasticsearch 中提取记录。我实际上使用的是 Elasticsearch Java 客户端。我在每个 JVM 上只创建一个客户端。使用这个客户端,将数据摄取到 Elasticsearch 中,并使用它从 Elasticsearch 中提取数据。提取数据写入文件并进行一些分析,再次写入文件并将数据摄取回弹性搜索。
这是在一个 JVM 上仅创建一个 Java 客户端并使其保持活动状态的最佳方式吗?
或在需要时创建客户端并摄取/提取数据,关闭它。
或者创建客户端池并重用它。(比如连接池)
做这个的最好方式是什么 ?
我想@Autowire用一个Filter.所以我在SecurityConfig下面定义我的过滤器:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(getA(), BasicAuthenticationFilter.class);
http.csrf().disable();
}
@Bean
public A getA(){
return new A();
}
Run Code Online (Sandbox Code Playgroud)
这个过滤器A扩展了Spring的GenericFilterBean.
当我调用控制器时,我得到低于输出,这显示过滤器命中两次.
filter A before
filter A before
mycontroller invoke
filter A after
filter A after
Run Code Online (Sandbox Code Playgroud)
我的观察是,这个额外的调用使用Spring容器调用,因为如果filter没有注册为bean,它只会被命中一次.是什么原因,我该如何解决?
我在我的应用程序中使用 Spring Security,这里是对用户进行身份验证的安全部分,但登录页面由 Spring Security 提供:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
public void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.authorizeRequests()
.antMatchers("/home*").hasRole("USER")
.and()
.formLogin();
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user")
.password("password")
.roles("USER")
}
}
Run Code Online (Sandbox Code Playgroud)
我想使用我的登录页面而不是 Spring 的登录页面,如下所示:
login.html:
<html lang='en'>
<head>
<title>WebApp</title>
<meta charset='utf-8' />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/login.css" />
</head>
<body>
<div class="login-page">
<img src='img/taxi_.jpg' style='width: 180px; margin-left: auto; margin-right: auto; …Run Code Online (Sandbox Code Playgroud) 我正在尝试删除应用程序。我使用ng new. 现在我想删除该应用程序。我可以使用 CLI 来完成吗?或者我可以直接删除文件夹吗?
我是 Spring/Spring Boot 的新手。我想使用的键值对数据application.properties/ application.ymlJava中的文件。我知道我们可以@Value在任何 POJO 类中使用来设置来自application.properties或application.yml文件的字段的默认值。
Q1)但是为什么我们需要另外两个?@ConfigurationProperties和@PropertySource。
Q2)@ConfigurationProperties和@PropertySource,两者都可以用来加载application.properties或application.yml文件中提到的外部数据?或者有什么限制?
PS:我尝试在互联网上搜索,但没有得到明确的答案。
您能帮助保护 Spring Boot 2 中的执行器端点吗?我检查了迁移指南,但它对我没有帮助。
这是我的安全配置:
@Configuration
@EnableWebSecurity
public class SecConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole("ADMIN")
.anyRequest().authenticated();
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我去http://localhost:8080/actuator/health它加载时无需登录。其他带有前缀的端点/actuator也不需要登录。我做错了什么?
我还使用此配置添加了 OAuth:
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients
.inMemory()
.withClient("client-id")
.scopes("read", "write")
.authorizedGrantTypes("password")
.secret("xxxxxx")
.accessTokenValiditySeconds(6000);
}
}
@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS) …Run Code Online (Sandbox Code Playgroud) java spring spring-security spring-boot spring-boot-actuator
我正在尝试执行参数化 JUnit 5 测试,如何完成以下任务?
@ParametrizedTest
@ValueSource //here it seems only one parameter is supported
public void myTest(String parameter, String expectedOutput)
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用@MethodSource,但我想知道在我的情况下我是否只需要更好地理解@ValueSource。