springboot1 缓存前端
摘要:@Configurationpublic class WebMvcConfig extends WebMvcConfigurerAdapter { public void addResourceHandlers(ResourceHandlerRegistry registry) { registry
阅读全文
jdbctemplate 批量插入
摘要:public void batchImport(List> list) { String sql = "insert into table1(field1, field2) values(?,?)"; int[] types = new int[2]; types[0] = Types.VARCHAR; types[1] = Types.NUMER...
阅读全文
springboot logback
摘要:/resources/logback-spring.xml<configuration> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classi
阅读全文
springboot org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
摘要:参考 https://www.cnblogs.com/luxd/p/8316243.html https://www.cnblogs.com/s648667069/p/6478559.html
阅读全文
spring jpa nativequery in与修改
摘要:参考 https://blog.csdn.net/a3025056/article/details/79022816
阅读全文
springboot jpa sql查询与传值
摘要:public interface ARepository extends PagingAndSortingRepository<A, APK>, JpaSpecificationExecutor<A> { @Query(value="select field1, field2 from table1
阅读全文
springboot security 获取当前登录用户名
摘要:System.out.println(((User)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getName()); ${session.SPRING_SECURITY_CONTEXT.authent
阅读全文
springboot jpa 审计
摘要:@SpringBootApplication @EnableJpaAuditing public class Application {...} @Component public class AuditorAwareImpl implements AuditorAware<String> { pu
阅读全文
springboot 缓存
摘要:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId></dependency>@Cacheable(value = "value1", k
阅读全文
jpa orderby
摘要:return criteriaQuery.where(in).orderBy(new OrderImpl(root.get("field1"))).getRestriction();
阅读全文
springboot 取消post数据大小限制
摘要:参考 https://blog.csdn.net/kkgbn/article/details/52088068 application.properties 添加 spring.servlet.multipart.max-file-size = 10Mb spring.http.multipart.
阅读全文
springboot引入springSecurity无法post提交表单
摘要:参考https://blog.csdn.net/shawearn1027/article/details/71119587 表单中添加<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/> 隐
阅读全文
springboot 面向切面
摘要:@Aspect @Configuration public class AspectTest { @Pointcut("execution(public String xxx.xxx.xxx.Controller+.method1(..))") public void xxxxx() {} @Around("xxxxx()") public Object executeBefo...
阅读全文
获取RequestMapping注解中的属性
摘要:参考:https://www.cnblogs.com/2013jiutian/p/7294053.html @RequestMapping("/value1") @Controller public Class A { @RequestMapping("/value2") public String
阅读全文
spring jpa exists
摘要:Subquery<A> subquery = criteriaQuery.subquery(A.class);Root<A> root1 = subquery.from(A.class);subquery = subquery.select(root1.get("attrx"));subquery
阅读全文
LocalDateTime json格式化
摘要:参考https://www.cnblogs.com/xiaozhang9/p/jackson.html?utm_source=itdadao&utm_medium=referral
阅读全文
springboot定时任务
摘要:@Configuration @EnableAsync @EnableScheduling public class CronConfig { @Autowired private ApiService apiService; @Scheduled(cron="0/5 * * * * ?") pub
阅读全文
spring JPA分页排序条件查询
摘要:@RequestMapping("/listByPage") public Page<Production> listByPage(int page, int size, String sortStr, boolean sortAscOrDesc, String searchObj) { Speci
阅读全文
spring security 非页面登录
摘要:参考https://stackoverflow.com/questions/36937414/auto-login-spring-securityUserDetails userDetails = userDetailsService.loadUserByUsername(username);Aut
阅读全文