style: 格式化代码

This commit is contained in:
2023-03-16 07:21:38 +08:00
parent 63147e4c08
commit 8233fd5141
21 changed files with 657 additions and 21 deletions

View File

@@ -2,7 +2,6 @@ package cn.hamster3.application.blog;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@EnableJpaAuditing

View File

@@ -17,7 +17,7 @@ public class DevSecurityConfiguration {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
log.info("development environment security settings enabled.");
return http.authorizeHttpRequests(request -> request
.anyRequest().permitAll())
.anyRequest().permitAll())
.cors().and()
.csrf().disable()
.formLogin()
@@ -26,7 +26,7 @@ public class DevSecurityConfiguration {
.and()
.build();
}
@Bean
public WebMvcConfigurer corsConfigurer() {
log.info("add cors configuration...");
@@ -34,11 +34,11 @@ public class DevSecurityConfiguration {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600);
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600);
}
};
}

View File

@@ -16,12 +16,12 @@ public class SecurityConfiguration {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
log.info("production environment security settings enabled.");
return http.authorizeHttpRequests(request -> request
.requestMatchers(HttpMethod.GET, "/", "/index", "/index.html").permitAll()
.requestMatchers(HttpMethod.GET, "/favicon.ico", "/assets/**").permitAll()
.requestMatchers(HttpMethod.GET, "/register", "/login").permitAll()
.requestMatchers(HttpMethod.GET, "/swagger-ui/**", "v3/api-docs/**").permitAll()
.requestMatchers(HttpMethod.POST, "/api/v1/user/").anonymous()
.anyRequest().authenticated())
.requestMatchers(HttpMethod.GET, "/", "/index", "/index.html").permitAll()
.requestMatchers(HttpMethod.GET, "/favicon.ico", "/assets/**").permitAll()
.requestMatchers(HttpMethod.GET, "/register", "/login").permitAll()
.requestMatchers(HttpMethod.GET, "/swagger-ui/**", "v3/api-docs/**").permitAll()
.requestMatchers(HttpMethod.POST, "/api/v1/user/").anonymous()
.anyRequest().authenticated())
.cors().and()
.csrf().disable()
.formLogin()

View File

@@ -0,0 +1,21 @@
package cn.hamster3.application.blog.controller;
import cn.hamster3.application.blog.vo.ResponseVO;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 网站设置相关接口
*/
@RestController
@RequestMapping(value = "/api/v1/settings", produces = MediaType.APPLICATION_JSON_VALUE)
public class SiteSettingController {
@GetMapping("/{path}/")
public ResponseVO<String> getSiteTitle(@PathVariable String path) {
return ResponseVO.success(path);
}
}

View File

@@ -6,7 +6,6 @@ import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import java.sql.Blob;
import java.util.Date;
@Getter

View File

@@ -6,7 +6,6 @@ import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import java.sql.Blob;
import java.util.Date;
@Getter

View File

@@ -5,11 +5,12 @@ import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 博文实体

View File

@@ -1,11 +1,13 @@
spring:
banner:
location: "classpath:/banner-dev.txt"
jpa:
hibernate:
# 自动创建 Entity 类的数据库表
ddl-auto: update
# open-in-view: true
# open-in-view: true
show-ddl: true
# show-sql: true
# show-sql: true
autoconfigure:
exclude:
# - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration