我认为,我有一个非常简单和基本的设置,用于本地运行带有一些身份验证的Spring Boot webapp.
我希望当我通过Spring Boot运行此应用程序时,我的自定义安全设置会在指定local配置文件时覆盖默认行为.
mvn -Dspring.profiles.active="local" spring-boot:run
也许我指的是profiles.active错误的,但是当应用程序运行时,它仍会吐出生成的密码以供使用,并且似乎不允许在/login没有所述身份验证的情况下访问该路径.
我也没有看到任何一个活跃的个人资料/env,这可能有点说.
我有一个WebSecurityConfigurer像这样被覆盖的:
@Configuration
@EnableWebSecurity
@Profile("local")
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().fullyAuthenticated().and().formLogin().permitAll();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("admin").password("admin").roles("ADMIN", "USER")
.and().withUser("user").password("user").roles("USER");
}
}
Run Code Online (Sandbox Code Playgroud)
我的主要@Configuration类是您的标准Spring Java风格的基本配置:
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud) 鉴于 Spring Data 和相关 REST 存储库的主要好处之一是大多数时候开发人员不必担心底层实现,是否有一种开箱即用的方式来利用 Spring Cloud Netflix 库,特别是本例中的 Hystrix 注释,无需扩展所提供的存储库接口中的每个调用或创建我自己的实现?
我有两个对象,p4和p5,它们有一个Date属性.在某些时候,构造函数工作正常:
p4.setClickDate(new Date(System.currentTimeMillis() - 86400000 * 4));
Run Code Online (Sandbox Code Playgroud)
将日期设置为2011年7月31日星期日11:01:39 EDT
而在其他情况下它不会:
p5.setClickDate(new Date(System.currentTimeMillis() - 86400000 * 70));
Run Code Online (Sandbox Code Playgroud)
将日期设置为2011年7月15日星期五04:04:26
根据我的计算,这应该将日期设定为70天,不是吗?
我可以使用Calendar来解决这个问题,但我很好奇为什么Date会这样做.
谢谢!
这是目前可通过扩展或本机功能实现的吗?
谢谢,
布兰登
java ×2
calendar ×1
date ×1
hystrix ×1
mercurial ×1
spring ×1
spring-boot ×1
spring-cloud ×1
spring-data ×1
spring-mvc ×1