在创建架构图时,如果您只是从数据库中获取数据而不写入数据,那么箭头应该指向哪里?我在想,它应该是双向的,因为应用程序从数据库请求并且数据返回到应用程序。或者它应该只是从数据库到应用程序,即使数据库无法自行执行操作?
当我使用安全性登录时,我无法使用该request.isUserInRole()方法.我认为没有设置用户的角色.
这是我的安全配置:
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled=true)
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private DataSource dataSource;
@Autowired
private UserDetailsServiceImplementation userDetailsService;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/signup").permitAll()
.antMatchers("/").permitAll()
//.antMatchers("/first").hasAuthority("Service_Center")
.antMatchers("/login").permitAll()
.anyRequest().fullyAuthenticated()
.and().formLogin()
.loginPage("/login")
.usernameParameter("email")
.passwordParameter("password")
.defaultSuccessUrl("/default")
.failureUrl("/login?error").permitAll()
.and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/login?logout")
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true).permitAll();
}
@Autowired
public void configAuthentication(AuthenticationManagerBuilder auth)
throws Exception {
auth.userDetailsService(userDetailsService);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的User实体:
@Entity
@Table(name="user")
public class User implements Serializable{
/**
*
*/
private static final long …Run Code Online (Sandbox Code Playgroud) “gradle build”和“gradle bootJar”有什么区别?如果我仍然可以使用 build 创建工件,为什么要使用 bootJar?
我使用 GitLab 合并请求将一些从开发到主控的更改合并,并压缩了提交。合并后,我比较了两个分支,它显示了错误的差异。我预计没有差异,因为合并后它们是相同的。我检查了提交图,发现开发分支和主分支现在已断开连接。
为什么合并后master分支领先于develop?这是预期的行为吗?我使用的是 Gitlab 12.9。我想保留开发分支以供将来开发,但我想避免出现不必要的差异。
为什么这个pom.xml可以mvn test在没有指定maven Surefire插件的情况下运行?
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lester</groupId>
<artifactId>junit-basics</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>junit-basics</name>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.jupiter.version>5.4.0</junit.jupiter.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
把插件放在pom.xml中和不放有什么区别?
我正在使用 Spring Batch 和 JPA,并且经历了 TransactionManager bean 冲突。我通过在步骤中将 TransactionManager 设置为 JpaTransactionManager 找到了解决方案。但根据此链接(https://github.com/spring-projects/spring-batch/issues/961),即使它对我有用,它也是不正确的。
@Autowired
private JpaTransactionManager transactionManager;
private Step buildTaskletStep() {
return stepBuilderFactory.get("SendCampaignStep")
.<UserAccount, UserAccount>chunk(pushServiceConfiguration.getCampaignBatchSize())
.reader(userAccountItemReader)
.processor(userAccountItemProcessor)
.writer(userAccountItemWriter)
.transactionManager(transactionManager)
.build();
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了实现 BatchConfigurer 的建议解决方案,但它与我使用以下代码禁用元数据表相冲突:
@Configuration
@EnableAutoConfiguration
@EnableBatchProcessing
public class BatchConfiguration extends DefaultBatchConfigurer {
@Override
public void setDataSource(DataSource dataSource) {
// override to do not set datasource even if a datasource exist.
// initialize will use a Map based JobRepository (instead of database)
}
}
Run Code Online (Sandbox Code Playgroud)
使用在步骤中设置 TransactionManager 的第一个解决方案会出现什么问题?
我必须将大量数据编组为 XML 格式。我正在研究 JAXB,因为它是 JDK 8 的一部分,但我不确定它如何处理大量数据。Jackson XML 是我遇到的另一个更新的库。Jackson 在将对象序列化为 XML 方面是否比 JAXB 更快?
java ×4
gitlab ×2
spring-boot ×2
architecture ×1
diagram ×1
git ×1
gitlab-ci ×1
gradle ×1
jackson ×1
jaxb ×1
maven ×1
spring ×1
spring-batch ×1
spring-mvc ×1