mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-10 20:57:18 +08:00
Merge branch '1.1.x' into dev
This commit is contained in:
BIN
.idea/icon.png
generated
BIN
.idea/icon.png
generated
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 21 KiB |
380
.style/p3c-codestyle.xml
Normal file
380
.style/p3c-codestyle.xml
Normal file
@@ -0,0 +1,380 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<profiles version="21">
|
||||
<profile kind="CodeFormatterProfile" name="P3C-CodeStyle" version="21">
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_preserve"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="82"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="82"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="18"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="48"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
</profile>
|
||||
</profiles>
|
63
CHANGELOG.md
63
CHANGELOG.md
@@ -1,39 +1,60 @@
|
||||
## [v1.1.1](https://github.com/Charles7c/continew-starter/compare/v1.1.0...v1.1.1) (2024-01-11)
|
||||
|
||||
### ✨ 新特性
|
||||
|
||||
* 【extension/crud】BaseService 增加 list 查询列表方法重载 ([81ed292](https://github.com/Charles7c/continew-starter/commit/81ed29284090edcfc5ea5351442b5de2ce1622df))
|
||||
* 【core】新增 SpringUtils 工具类 ([3de75cf](https://github.com/Charles7c/continew-starter/commit/3de75cf7fe79bc86ca5022d56e5f46be4d90d623))
|
||||
|
||||
### 💎 功能优化
|
||||
|
||||
- 【log/httptrace-pro】优化日志过滤器,仅在需要记录请求体、响应体时进行过滤 ([d68d88d](https://github.com/Charles7c/continew-starter/commit/d68d88db218d5008140c3056827dd6ac608a8b62))
|
||||
- 【log/httptrace-pro】优化 @Log 注解信息获取优先级逻辑 ([Gitee PR#5](https://gitee.com/Charles7c/continew-starter/pulls/5))
|
||||
- 【extension/crud】优化 BaseServiceImpl 中获取各泛型参数类型的方式 ([6fc0b51](https://github.com/Charles7c/continew-starter/commit/6fc0b51a574434db9d21d1f254b3fce344c9f2f6))
|
||||
- 【extension/crud】减少查询列表时可能的无用转换 ([0565372](https://github.com/Charles7c/continew-starter/commit/0565372e9aa8010a1c4625be4cf85d557a7eed7b))
|
||||
- 使用常量优化部分配置属性名 ([2025068](https://github.com/Charles7c/continew-starter/commit/20250681da7682de159b6259e80193b204e55047))
|
||||
- 优化日志级别 info => debug ([1e7d4b2](https://github.com/Charles7c/continew-starter/commit/1e7d4b2721fae3459cb6d1b57f208f0c38dbbc6f))
|
||||
- 优化全局代码格式 ([57c21a9](https://github.com/Charles7c/continew-starter/commit/57c21a9109a412ed78c6c9b8aa0cd0f0b5724432))
|
||||
|
||||
### 💥 破坏性变更
|
||||
|
||||
- 【extension/crud】PageDataResp => PageResp ([38d2800](https://github.com/Charles7c/continew-starter/commit/38d28004d63a0218bfcae5689f9909ce6dcd824f))
|
||||
|
||||
## [v1.1.0](https://github.com/Charles7c/continew-starter/compare/v1.0.1...v1.1.0) (2023-12-31)
|
||||
|
||||
### ✨ 新特性
|
||||
|
||||
* 【log/httptrace-pro】新增 continew-starter-log-httptrace-pro 日志模块(Spring Boot Actuator HttpTrace 重置增强版)
|
||||
* 【storage/local】新增 continew-starter-storage-local 本地存储模块 ([7e5ff2e](https://github.com/Charles7c/continew-starter/commit/cd6826a0abe0666f9fe867e92bf70abb47e5ff2e))
|
||||
* 【cache/redisson】RedisUtils 新增限流方法 ([fc5c20c](https://github.com/Charles7c/continew-starter/commit/9cf3ae87a1a20db9ee8b2b7272e8328b5fc5c20c))
|
||||
* 【data/mybatis-plus】新增数据权限默认解决方案 ([31e09af](https://github.com/Charles7c/continew-starter/commit/621a5e3b22db9b81d31c65b39ad387a8531e09af))
|
||||
* 【storage/local】新增 continew-starter-storage-local 本地存储模块 ([cd6826a](https://github.com/Charles7c/continew-starter/commit/cd6826a0abe0666f9fe867e92bf70abb47e5ff2e))
|
||||
* 【cache/redisson】RedisUtils 新增限流方法 ([9cf3ae8](https://github.com/Charles7c/continew-starter/commit/9cf3ae87a1a20db9ee8b2b7272e8328b5fc5c20c))
|
||||
* 【data/mybatis-plus】新增数据权限默认解决方案 ([621a5e3](https://github.com/Charles7c/continew-starter/commit/621a5e3b22db9b81d31c65b39ad387a8531e09af))
|
||||
* 【captcha/behavior】新增 continew-starter-captcha-behavior 行为验证码模块 ([Gitee PR#1](https://gitee.com/Charles7c/continew-starter/pulls/1))
|
||||
* 【core】新增 PATH_PATTERN 字符串常量 ([40d0f7f](https://github.com/Charles7c/continew-starter/commit/76e282c7965fdfa39854fe77397687bbc40d0f7f))
|
||||
* 【core】新增 PATH_PATTERN 字符串常量 ([76e282c](https://github.com/Charles7c/continew-starter/commit/76e282c7965fdfa39854fe77397687bbc40d0f7f))
|
||||
|
||||
### 💎 功能优化
|
||||
|
||||
- 【core】优化跨域配置默认值 ([23233ce](https://github.com/Charles7c/continew-starter/commit/65f5fbd6daa9ae2c8aedd13c487e8985523233ce))
|
||||
- 【extension/crud】新增全局异常处理器 ([a285b55](https://github.com/Charles7c/continew-starter/commit/c4459d1b8d701a4405f74ea92cfc87752a285b55))
|
||||
- 【extension/crud】移除部分方法中仅有单个非读操作的事务处理 ([54f83f5](https://github.com/Charles7c/continew-starter/commit/70ae383de62bc3c6ae0d2e1c3cf5c005d54f83f5))
|
||||
- 【core】优化跨域配置默认值 ([65f5fbd](https://github.com/Charles7c/continew-starter/commit/65f5fbd6daa9ae2c8aedd13c487e8985523233ce))
|
||||
- 【extension/crud】新增全局异常处理器 ([c4459d1](https://github.com/Charles7c/continew-starter/commit/c4459d1b8d701a4405f74ea92cfc87752a285b55))
|
||||
- 【extension/crud】移除部分方法中仅有单个非读操作的事务处理 ([70ae383](https://github.com/Charles7c/continew-starter/commit/70ae383de62bc3c6ae0d2e1c3cf5c005d54f83f5))
|
||||
|
||||
### 📦 依赖升级
|
||||
|
||||
- 【dependencies】Spring Boot 3.1.5 => 3.1.7 ([8636605](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Just Auth 1.16.5 => 1.16.6 ([8636605](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Redisson 3.24.3 => 3.25.2 ([8636605](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Easy Excel 3.3.2 => 3.3.3 ([8636605](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Knife4j 4.3.0 => 4.4.0 ([8636605](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Hutool 5.8.23 => 5.8.24 ([8636605](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】MyBatis Plus 3.5.4.1 => 3.5.5(修复与 Spring Boot 3.1.7 的 DdlApplicationRunner冲突错误) ([b36d578](https://github.com/Charles7c/continew-starter/commit/556bfb924a1e5834fe0a101b9ff52cc5bb36d578))
|
||||
- 【dependencies】新增 X File Storage 依赖版本 2.0.0 ([016de2d](https://github.com/Charles7c/continew-starter/commit/be7972c00be8d62cc25332e053a985532016de2d))
|
||||
- 【dependencies】ip2region 3.1.5.1 => 3.1.6 ([980c929](https://github.com/Charles7c/continew-starter/commit/4dae89e0f21ac6c532101e983ee4007f3980c929))
|
||||
- 【dependencies】新增 Amazon S3 依赖版本 1.12.626 ([97e4a2d](https://github.com/Charles7c/continew-starter/commit/48f894b8b62f8b968091dcea51b57336b97e4a2d))
|
||||
- 【dependencies】Spring Boot 3.1.5 => 3.1.7 ([72f5569](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Just Auth 1.16.5 => 1.16.6 ([72f5569](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Redisson 3.24.3 => 3.25.2 ([72f5569](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Easy Excel 3.3.2 => 3.3.3 ([72f5569](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Knife4j 4.3.0 => 4.4.0 ([72f5569](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】Hutool 5.8.23 => 5.8.24 ([72f5569](https://github.com/Charles7c/continew-starter/commit/72f55697cc8958bf3586daed03a8d1b3c8636605))
|
||||
- 【dependencies】MyBatis Plus 3.5.4.1 => 3.5.5(修复与 Spring Boot 3.1.7 的 DdlApplicationRunner冲突错误) ([556bfb9](https://github.com/Charles7c/continew-starter/commit/556bfb924a1e5834fe0a101b9ff52cc5bb36d578))
|
||||
- 【dependencies】新增 X File Storage 依赖版本 2.0.0 ([be7972c](https://github.com/Charles7c/continew-starter/commit/be7972c00be8d62cc25332e053a985532016de2d))
|
||||
- 【dependencies】ip2region 3.1.5.1 => 3.1.6 ([4dae89e](https://github.com/Charles7c/continew-starter/commit/4dae89e0f21ac6c532101e983ee4007f3980c929))
|
||||
- 【dependencies】新增 Amazon S3 依赖版本 1.12.626 ([48f894b](https://github.com/Charles7c/continew-starter/commit/48f894b8b62f8b968091dcea51b57336b97e4a2d))
|
||||
|
||||
### 💥 破坏性变更
|
||||
|
||||
- 【captcha/graphic】优化图形验证码配置前缀 ([7b3e450](https://github.com/Charles7c/continew-starter/commit/e0e5944b45bcbf8a4b7a5066ad347459a7b3e450))
|
||||
- 【data/mybatis-plus】调整 IBaseEnum 所属包 enums => base ([522833c](https://github.com/Charles7c/continew-starter/commit/22fee2f5bd8211e26c2f6a163a6298f5b522833c))
|
||||
- 【auth/satoken】SaTokenDaoTypeEnum => SaTokenDaoType ([86e35c4](https://github.com/Charles7c/continew-starter/commit/0a0d022586dc88a773512c5761c68d62786e35c4))
|
||||
- 【core】使用常量优化部分魔法值,核心模块部分配置前缀调整 ([999f899](https://github.com/Charles7c/continew-starter/commit/52dce2acdfa0296c3f6f4875f14a0299f999f899))
|
||||
- 【captcha/graphic】优化图形验证码配置前缀 ([e0e5944](https://github.com/Charles7c/continew-starter/commit/e0e5944b45bcbf8a4b7a5066ad347459a7b3e450))
|
||||
- 【data/mybatis-plus】调整 IBaseEnum 所属包 enums => base ([22fee2f](https://github.com/Charles7c/continew-starter/commit/22fee2f5bd8211e26c2f6a163a6298f5b522833c))
|
||||
- 【auth/satoken】SaTokenDaoTypeEnum => SaTokenDaoType ([0a0d022](https://github.com/Charles7c/continew-starter/commit/0a0d022586dc88a773512c5761c68d62786e35c4))
|
||||
- 【core】使用常量优化部分魔法值,核心模块部分配置前缀调整 ([52dce2a](https://github.com/Charles7c/continew-starter/commit/52dce2acdfa0296c3f6f4875f14a0299f999f899))
|
||||
|
||||
## [v1.0.1](https://github.com/Charles7c/continew-starter/compare/v1.0.0...v1.0.1) (2023-12-13)
|
||||
|
||||
|
43
README.md
43
README.md
@@ -4,7 +4,7 @@
|
||||
<img src="https://img.shields.io/badge/License-LGPL--3.0-blue.svg" alt="License" />
|
||||
</a>
|
||||
<a href="https://github.com/Charles7c/continew-starter" target="_blank">
|
||||
<img src="https://img.shields.io/badge/RELEASE-v1.1.0-%23ff3f59.svg" alt="Release" />
|
||||
<img src="https://img.shields.io/badge/RELEASE-v1.1.1-%23ff3f59.svg" alt="Release" />
|
||||
</a>
|
||||
<a href="https://github.com/Charles7c/continew-starter" target="_blank">
|
||||
<img src="https://img.shields.io/github/stars/Charles7c/continew-starter?style=social" alt="GitHub stars" />
|
||||
@@ -18,14 +18,20 @@
|
||||
<a href="https://gitee.com/Charles7c/continew-starter" target="_blank">
|
||||
<img src="https://gitee.com/Charles7c/continew-starter/badge/fork.svg?theme=white" alt="Gitee forks" />
|
||||
</a>
|
||||
<a href="https://github.com/Charles7c/continew-starter" target="_blank">
|
||||
<img src="https://img.shields.io/badge/Spring Boot-3.1.7-%236CB52D.svg" alt="Release" />
|
||||
</a>
|
||||
<a href="https://github.com/Charles7c/continew-starter" target="_blank">
|
||||
<img src="https://img.shields.io/badge/Java-17-%236CB52D.svg" alt="Release" />
|
||||
</a>
|
||||
|
||||
## 简介
|
||||
|
||||
ContiNew Starter(Continue New Starter)是一种特殊类型的 Spring Boot Starter,其作用与常规的 Starter 类似,基于“约定优于配置”的理念,再次精简常规配置,提供一个更为完整的配置解决方案,帮助开发人员更加快速的集成常用第三方库或工具到 Spring Boot Web 应用程序中。
|
||||
ContiNew Starter(Continue New Starter)基于“约定优于配置”的理念,再次精简常规配置,提供一个更为完整的配置解决方案,帮助开发人员更加快速的集成常用第三方库或工具到 Spring Boot Web 应用程序中。
|
||||
|
||||
ContiNew Starter 包含了一系列经过企业实践优化和配置的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,从而避免开发人员手动引入依赖的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。
|
||||
ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。
|
||||
|
||||
> ContiNew Starter 源自 [ContiNew Admin](https://github.com/Charles7c/continew-admin) 后台管理框架/脚手架项目。在 ContiNew Admin 发展到一定程度时,作者发现新手用户上手时需要关注过多的脚手架通用基础能力,而且如果想要在一个全新项目中使用这些基础能力,“迁移”起来也很麻烦。于是,ContiNew Starter 应运而生,作者在 ContiNew Admin 2.x 版本时,将项目中的通用基础能力进行了抽离和深度优化。这样,无论是在 ContiNew Admin 中使用,还是单独使用这些基础能力,都可以更加轻松。
|
||||
> ContiNew Starter 源自 [ContiNew Admin](https://github.com/Charles7c/continew-admin) 中后台管理框架/脚手架项目。在 ContiNew Admin 发展到一定程度时,作者发现新手用户上手时需要关注过多的脚手架通用基础能力,而且如果想要在一个全新项目中使用这些基础能力,“迁移”起来也很麻烦。于是,ContiNew Starter 应运而生,作者在 ContiNew Admin 2.x 版本时,将项目中的通用基础能力进行了抽离和深度优化。这样,无论是在 ContiNew Admin 中使用,还是单独使用这些基础能力,都可以更加轻松。
|
||||
|
||||
## 解决痛点
|
||||
|
||||
@@ -109,16 +115,17 @@ e.g. 跨域配置
|
||||
|
||||
```yaml
|
||||
--- ### 跨域配置
|
||||
cors:
|
||||
enabled: true
|
||||
# 配置允许跨域的域名
|
||||
allowed-origins: '*'
|
||||
# 配置允许跨域的请求方式
|
||||
allowed-methods: '*'
|
||||
# 配置允许跨域的请求头
|
||||
allowed-headers: '*'
|
||||
# 配置允许跨域的响应头
|
||||
exposed-headers: '*'
|
||||
continew-starter:
|
||||
cors:
|
||||
enabled: true
|
||||
# 配置允许跨域的域名
|
||||
allowed-origins: '*'
|
||||
# 配置允许跨域的请求方式
|
||||
allowed-methods: '*'
|
||||
# 配置允许跨域的请求头
|
||||
allowed-headers: '*'
|
||||
# 配置允许跨域的响应头
|
||||
exposed-headers: '*'
|
||||
```
|
||||
|
||||
<details>
|
||||
@@ -192,12 +199,12 @@ ContiNew Starter 的分支目前分为下个大版本的开发分支和上个大
|
||||
|
||||
请记住,如果您有任何疑问或需要帮助,我们将随时提供支持。
|
||||
|
||||
> **IMPORTANT**
|
||||
> [!IMPORTANT]
|
||||
> 欢迎大家为 ContiNew Starter 贡献代码,我们非常感谢您的支持!为了更好地管理项目,维护者有一些要求:
|
||||
>
|
||||
> 1. 请确保代码、配置文件的结构和命名规范良好,完善的代码注释,并遵循阿里巴巴的 <a href="https://github.com/Charles7c/continew-starter/blob/dev/code-style/Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C(%E9%BB%84%E5%B1%B1%E7%89%88).pdf" target="_blank">《Java开发手册(黄山版)》</a> 中的代码规范,保证代码质量和可维护性
|
||||
> 1. 请确保代码、配置文件的结构和命名规范良好,完善的代码注释,并遵循阿里巴巴的 <a href="https://github.com/Charles7c/continew-starter/blob/dev/.style/Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C(%E9%BB%84%E5%B1%B1%E7%89%88).pdf" target="_blank">《Java开发手册(黄山版)》</a> 中的代码规范,保证代码质量和可维护性
|
||||
> 2. 在提交代码前,请按照 [Angular 提交规范](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) 编写 commit 的 message(建议在 IntelliJ IDEA 中下载并安装 Git Commit Template 插件,以便按照规范进行 commit)
|
||||
> 3. 提交代码之前,请关闭所有代码窗口,执行 mvn compile 命令,编译通过后,不要再打开查看任何代码窗口,直接提交即可
|
||||
> 3. 提交代码之前,请关闭所有代码窗口,执行 `mvn compile` 命令(代码格式化插件会在项目编译时对全局代码进行格式修正),编译通过后,不要再打开查看任何代码窗口,直接提交即可
|
||||
|
||||
## 反馈交流
|
||||
|
||||
@@ -233,7 +240,7 @@ ContiNew Starter 的分支目前分为下个大版本的开发分支和上个大
|
||||
- 感谢 <a href="https://www.jetbrains.com/" target="_blank">JetBrains</a> 提供的 <a href="https://www.jetbrains.com/shop/eform/opensource" target="_blank">非商业开源软件开发授权</a>
|
||||
- 感谢 <a href="https://github.com/baomidou/mybatis-plus" target="_blank">MyBatis Plus</a>、<a href="https://github.com/dromara/sa-token" target="_blank">Sa-Token</a> 、<a href="https://github.com/xiaoymin/knife4j" target="_blank">Knife4j</a>、<a href="https://github.com/dromara/hutool" target="_blank">Hutool</a> 等国产开源组件作者为国内开源世界作出的贡献
|
||||
- 感谢 <a href="https://github.com/elunez/eladmin" target="_blank">ELADMIN</a>、<a href="https://github.com/dromara/RuoYi-Vue-Plus" target="_blank">RuoYi-Vue-Plus</a>、<a href="https://gitee.com/herodotus/dante-engine" target="_blank">Dante-Engine</a>,致敬各位作者为开源脚手架领域作出的贡献
|
||||
- e.g. 脱胎于 ELADMIN 项目开源的 QueryHelper 组件
|
||||
- e.g. 扩展于 ELADMIN 项目开源的 QueryHelper 组件
|
||||
- e.g. 扩展于 RuoYi-Vue-Plus 项目封装的 SaToken 相关认证鉴权配置
|
||||
- e.g. 扩展于 Dante-Engine 项目封装的 Redisson 相关配置
|
||||
- 感谢项目使用或未使用到的每一款开源组件,致敬各位开源先驱 :fire:
|
||||
|
@@ -44,7 +44,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* API 文档自动配置
|
||||
*
|
||||
@@ -63,8 +62,9 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/");
|
||||
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/")
|
||||
.setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
|
||||
registry.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/")
|
||||
.setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,20 +73,16 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public OpenAPI openApi(ProjectProperties projectProperties, SpringDocExtensionProperties properties) {
|
||||
Info info = new Info()
|
||||
.title(String.format("%s %s", projectProperties.getName(), "API 文档"))
|
||||
.version(projectProperties.getVersion())
|
||||
.description(projectProperties.getDescription());
|
||||
Info info = new Info().title(String.format("%s %s", projectProperties.getName(), "API 文档"))
|
||||
.version(projectProperties.getVersion())
|
||||
.description(projectProperties.getDescription());
|
||||
ProjectProperties.Contact contact = projectProperties.getContact();
|
||||
if (null != contact) {
|
||||
info.contact(new Contact().name(contact.getName())
|
||||
.email(contact.getEmail())
|
||||
.url(contact.getUrl()));
|
||||
info.contact(new Contact().name(contact.getName()).email(contact.getEmail()).url(contact.getUrl()));
|
||||
}
|
||||
ProjectProperties.License license = projectProperties.getLicense();
|
||||
if (null != license) {
|
||||
info.license(new License().name(license.getName())
|
||||
.url(license.getUrl()));
|
||||
info.license(new License().name(license.getName()).url(license.getUrl()));
|
||||
}
|
||||
OpenAPI openAPI = new OpenAPI();
|
||||
openAPI.info(info);
|
||||
@@ -120,7 +116,10 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
|
||||
Map<String, SecurityScheme> securitySchemeMap = components.getSecuritySchemes();
|
||||
pathItem.readOperations().forEach(operation -> {
|
||||
SecurityRequirement securityRequirement = new SecurityRequirement();
|
||||
List<String> list = securitySchemeMap.values().stream().map(SecurityScheme::getName).toList();
|
||||
List<String> list = securitySchemeMap.values()
|
||||
.stream()
|
||||
.map(SecurityScheme::getName)
|
||||
.toList();
|
||||
list.forEach(securityRequirement::addList);
|
||||
operation.addSecurityItem(securityRequirement);
|
||||
});
|
||||
@@ -132,6 +131,6 @@ public class SpringDocAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'ApiDoc' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'ApiDoc' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
|
||||
|
||||
/**
|
||||
* API 文档扩展配置属性
|
||||
*
|
||||
|
@@ -51,6 +51,6 @@ public class JustAuthAutoConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'JustAuth' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'JustAuth' completed initialization.");
|
||||
}
|
||||
}
|
@@ -40,8 +40,7 @@ public class JustAuthStateCacheRedisImpl implements AuthStateCache {
|
||||
@Override
|
||||
public void cache(String key, String value) {
|
||||
// 参考:在 JustAuth 中,内置了一个基于 map 的 state 缓存器,默认缓存有效期为 3 分钟
|
||||
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value,
|
||||
Duration.ofMinutes(3));
|
||||
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value, Duration.ofMinutes(3));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,8 +52,7 @@ public class JustAuthStateCacheRedisImpl implements AuthStateCache {
|
||||
*/
|
||||
@Override
|
||||
public void cache(String key, String value, long timeout) {
|
||||
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value,
|
||||
Duration.ofMillis(timeout));
|
||||
RedisUtils.set(RedisUtils.formatKey(KEY_PREFIX, key), value, Duration.ofMillis(timeout));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -57,8 +57,9 @@ public class SaTokenAutoConfiguration implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())).addPathPatterns(StringConstants.PATH_PATTERN)
|
||||
.excludePathPatterns(properties.getSecurity().getExcludes());
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||
.addPathPatterns(StringConstants.PATH_PATTERN)
|
||||
.excludePathPatterns(properties.getSecurity().getExcludes());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +89,6 @@ public class SaTokenAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'SaToken' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'SaToken' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import top.charles7c.continew.starter.auth.satoken.properties.SaTokenDaoProperties;
|
||||
import top.charles7c.continew.starter.auth.satoken.properties.SaTokenSecurityProperties;
|
||||
|
||||
|
||||
/**
|
||||
* SaToken 扩展配置属性
|
||||
*
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<description>ContiNew Starter 缓存模块 - Redisson</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Redisson(不仅仅是一个 Redis Java 客户端) -->
|
||||
<!-- Redisson(不仅仅是一个 Redis Java 客户端,Redisson 充分的利用了 Redis 键值数据库提供的一系列优势,为使用者提供了一系列具有分布式特性的常用工具:分布式锁、限流器等) -->
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
|
@@ -86,7 +86,9 @@ public class RedissonAutoConfiguration {
|
||||
// 下方配置如果为空,则使用 Redis 的配置
|
||||
if (CollUtil.isEmpty(sentinelServersConfig.getSentinelAddresses())) {
|
||||
List<String> nodeList = redisProperties.getSentinel().getNodes();
|
||||
nodeList.stream().map(node -> protocol + node).forEach(sentinelServersConfig::addSentinelAddress);
|
||||
nodeList.stream()
|
||||
.map(node -> protocol + node)
|
||||
.forEach(sentinelServersConfig::addSentinelAddress);
|
||||
}
|
||||
if (StrUtil.isBlank(sentinelServersConfig.getPassword())) {
|
||||
sentinelServersConfig.setPassword(redisProperties.getPassword());
|
||||
@@ -107,13 +109,14 @@ public class RedissonAutoConfiguration {
|
||||
singleServerConfig.setPassword(redisProperties.getPassword());
|
||||
}
|
||||
if (StrUtil.isBlank(singleServerConfig.getAddress())) {
|
||||
singleServerConfig.setAddress(protocol + redisProperties.getHost() + StringConstants.COLON + redisProperties.getPort());
|
||||
singleServerConfig.setAddress(protocol + redisProperties
|
||||
.getHost() + StringConstants.COLON + redisProperties.getPort());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Jackson 处理
|
||||
config.setCodec(new JsonJacksonCodec(objectMapper));
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Redisson' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Redisson' completed initialization.");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@ import org.redisson.config.SentinelServersConfig;
|
||||
import org.redisson.config.SingleServerConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
|
||||
/**
|
||||
* Redisson 配置属性
|
||||
*
|
||||
|
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -50,7 +51,7 @@ import java.util.Properties;
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(prefix = "continew-starter.captcha.behavior", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_BEHAVIOR, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
@EnableConfigurationProperties(BehaviorCaptchaProperties.class)
|
||||
public class BehaviorCaptchaAutoConfiguration {
|
||||
|
||||
@@ -61,8 +62,7 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
*/
|
||||
@Configuration
|
||||
@Import({BehaviorCaptchaCacheConfiguration.Redis.class, BehaviorCaptchaCacheConfiguration.Custom.class})
|
||||
protected static class BehaviorCaptchaCacheAutoConfiguration {
|
||||
}
|
||||
protected static class BehaviorCaptchaCacheAutoConfiguration {}
|
||||
|
||||
/**
|
||||
* 行为验证码服务接口
|
||||
@@ -93,8 +93,8 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
config.put(Const.CAPTCHA_FONT_SIZE, properties.getFontSize());
|
||||
config.put(Const.CAPTCHA_FONT_STYLE, properties.getFontStyle());
|
||||
config.put(Const.CAPTCHA_WORD_COUNT, 4);
|
||||
if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:")
|
||||
|| StrUtil.startWith(properties.getPicClickBaseMapPath(), "classpath:")) {
|
||||
if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || StrUtil.startWith(properties
|
||||
.getPicClickBaseMapPath(), "classpath:")) {
|
||||
// 自定义 resources 目录下初始化底图
|
||||
config.put(Const.CAPTCHA_INIT_ORIGINAL, true);
|
||||
initializeBaseMap(properties.getJigsawBaseMapPath(), properties.getPicClickBaseMapPath());
|
||||
@@ -109,9 +109,8 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
* @param picClick 点选验证码底图路径
|
||||
*/
|
||||
private static void initializeBaseMap(String jigsaw, String picClick) {
|
||||
ImageUtils.cacheBootImage(getResourcesImagesFile(jigsaw + "/original/*.png"),
|
||||
getResourcesImagesFile(jigsaw + "/slidingBlock/*.png"),
|
||||
getResourcesImagesFile(picClick + "/*.png"));
|
||||
ImageUtils
|
||||
.cacheBootImage(getResourcesImagesFile(jigsaw + "/original/*.png"), getResourcesImagesFile(jigsaw + "/slidingBlock/*.png"), getResourcesImagesFile(picClick + "/*.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,6 +137,6 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Behavior Captcha' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior Captcha' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoConfiguration;
|
||||
import top.charles7c.continew.starter.captcha.behavior.enums.StorageType;
|
||||
import top.charles7c.continew.starter.captcha.behavior.impl.BehaviorCaptchaCacheServiceImpl;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
/**
|
||||
* 行为验证码缓存配置
|
||||
@@ -49,10 +50,11 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
*/
|
||||
@ConditionalOnClass(RedisClient.class)
|
||||
@AutoConfigureBefore(RedissonAutoConfiguration.class)
|
||||
@ConditionalOnProperty(name = "continew-starter.captcha.behavior.cache-type", havingValue = "redis")
|
||||
@ConditionalOnProperty(name = PropertiesConstants.CAPTCHA_BEHAVIOR + ".cache-type", havingValue = "redis")
|
||||
static class Redis {
|
||||
static {
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name().toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name()
|
||||
.toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Redis' completed initialization.");
|
||||
}
|
||||
}
|
||||
@@ -60,7 +62,7 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
/**
|
||||
* 自定义缓存实现类-自定义
|
||||
*/
|
||||
@ConditionalOnProperty(name = "continew-starter.captcha.behavior.cache-type", havingValue = "custom")
|
||||
@ConditionalOnProperty(name = PropertiesConstants.CAPTCHA_BEHAVIOR + ".cache-type", havingValue = "custom")
|
||||
static class Custom {
|
||||
|
||||
@Bean
|
||||
@@ -71,7 +73,8 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), SpringUtil.getBean(CaptchaCacheService.class));
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), SpringUtil
|
||||
.getBean(CaptchaCacheService.class));
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Custom' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ import com.anji.captcha.service.CaptchaCacheService;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import top.charles7c.continew.starter.captcha.behavior.enums.StorageType;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -31,7 +32,7 @@ import java.awt.*;
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.captcha.behavior")
|
||||
@ConfigurationProperties(PropertiesConstants.CAPTCHA_BEHAVIOR)
|
||||
public class BehaviorCaptchaProperties {
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
/**
|
||||
* 图形验证码自动配置
|
||||
@@ -31,11 +32,11 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(GraphicCaptchaProperties.class)
|
||||
@ConditionalOnProperty(prefix = "continew-starter.captcha.graphic", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_GRAPHIC, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
public class GraphicCaptchaAutoConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Graphic Captcha' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Graphic Captcha' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import com.wf.captcha.base.Captcha;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import top.charles7c.continew.starter.captcha.graphic.enums.GraphicCaptchaType;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -32,7 +33,7 @@ import java.awt.*;
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.captcha.graphic")
|
||||
@ConfigurationProperties(PropertiesConstants.CAPTCHA_GRAPHIC)
|
||||
public class GraphicCaptchaProperties {
|
||||
|
||||
/**
|
||||
|
@@ -54,8 +54,7 @@ public enum GraphicCaptchaType {
|
||||
/**
|
||||
* 特殊类型
|
||||
*/
|
||||
SPEC(SpecCaptcha.class),
|
||||
;
|
||||
SPEC(SpecCaptcha.class),;
|
||||
|
||||
/**
|
||||
* 验证码实现
|
||||
|
@@ -27,6 +27,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
import top.charles7c.continew.starter.core.constant.StringConstants;
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ import top.charles7c.continew.starter.core.constant.StringConstants;
|
||||
@Lazy
|
||||
@AutoConfiguration
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnProperty(prefix = "continew-starter.cors", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.CORS, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
@EnableConfigurationProperties(CorsProperties.class)
|
||||
public class CorsAutoConfiguration {
|
||||
|
||||
@@ -70,7 +71,7 @@ public class CorsAutoConfiguration {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration(StringConstants.PATH_PATTERN, config);
|
||||
CorsFilter corsFilter = new CorsFilter(source);
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'CorsFilter' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'CorsFilter' completed initialization.");
|
||||
return corsFilter;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package top.charles7c.continew.starter.core.autoconfigure.cors;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
import top.charles7c.continew.starter.core.constant.StringConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -31,7 +32,7 @@ import java.util.List;
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.cors")
|
||||
@ConfigurationProperties(PropertiesConstants.CORS)
|
||||
public class CorsProperties {
|
||||
|
||||
/**
|
||||
|
@@ -81,8 +81,9 @@ public class ProjectProperties {
|
||||
public static final boolean IP_ADDR_LOCAL_PARSE_ENABLED;
|
||||
|
||||
static {
|
||||
IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil.getProperty("project.ip-addr-local-parse-enabled", boolean.class, false)
|
||||
|| SpringUtil.getProperty("project.ipAddrLocalParseEnabled", boolean.class, false);
|
||||
IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil
|
||||
.getProperty("project.ip-addr-local-parse-enabled", boolean.class, false) || SpringUtil
|
||||
.getProperty("project.ipAddrLocalParseEnabled", boolean.class, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
import top.charles7c.continew.starter.core.exception.BaseException;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -42,7 +43,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
@Lazy
|
||||
@AutoConfiguration
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(prefix = "continew-starter.thread-pool", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.THREAD_POOL, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
public class AsyncAutoConfiguration implements AsyncConfigurer {
|
||||
|
||||
@@ -53,7 +54,7 @@ public class AsyncAutoConfiguration implements AsyncConfigurer {
|
||||
*/
|
||||
@Override
|
||||
public Executor getAsyncExecutor() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'AsyncConfigurer' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'AsyncConfigurer' completed initialization.");
|
||||
return scheduledExecutorService;
|
||||
}
|
||||
|
||||
@@ -65,8 +66,10 @@ public class AsyncAutoConfiguration implements AsyncConfigurer {
|
||||
return (throwable, method, objects) -> {
|
||||
throwable.printStackTrace();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Exception message: ").append(throwable.getMessage()).append(", Method name: ")
|
||||
.append(method.getName());
|
||||
sb.append("Exception message: ")
|
||||
.append(throwable.getMessage())
|
||||
.append(", Method name: ")
|
||||
.append(method.getName());
|
||||
if (ArrayUtil.isNotEmpty(objects)) {
|
||||
sb.append(", Parameter value: ").append(Arrays.toString(objects));
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
import top.charles7c.continew.starter.core.util.ExceptionUtils;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -42,7 +43,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(prefix = "continew-starter.thread-pool", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.THREAD_POOL, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
@EnableConfigurationProperties(ThreadPoolProperties.class)
|
||||
public class ThreadPoolAutoConfiguration {
|
||||
|
||||
@@ -67,7 +68,7 @@ public class ThreadPoolAutoConfiguration {
|
||||
executor.setKeepAliveSeconds(properties.getKeepAliveSeconds());
|
||||
// 配置当池内线程数已达到上限的时候,该如何处理新任务:不在新线程中执行任务,而是由调用者所在的线程来执行
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'ThreadPoolTaskExecutor' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'ThreadPoolTaskExecutor' completed initialization.");
|
||||
return executor;
|
||||
}
|
||||
|
||||
@@ -77,16 +78,16 @@ public class ThreadPoolAutoConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ScheduledExecutorService scheduledExecutorService(ThreadPoolProperties properties) {
|
||||
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ObjectUtil.defaultIfNull(properties.getCorePoolSize(), corePoolSize),
|
||||
ThreadUtil.newNamedThreadFactory("schedule-pool-%d", true),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy()) {
|
||||
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ObjectUtil.defaultIfNull(properties
|
||||
.getCorePoolSize(), corePoolSize), ThreadUtil
|
||||
.newNamedThreadFactory("schedule-pool-%d", true), new ThreadPoolExecutor.CallerRunsPolicy()) {
|
||||
@Override
|
||||
protected void afterExecute(Runnable runnable, Throwable throwable) {
|
||||
super.afterExecute(runnable, throwable);
|
||||
ExceptionUtils.printException(runnable, throwable);
|
||||
}
|
||||
};
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'ScheduledExecutorService' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'ScheduledExecutorService' completed initialization.");
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package top.charles7c.continew.starter.core.autoconfigure.threadpool;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
/**
|
||||
* 线程池配置属性
|
||||
@@ -27,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.thread-pool")
|
||||
@ConfigurationProperties(PropertiesConstants.THREAD_POOL)
|
||||
public class ThreadPoolProperties {
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
* <p>
|
||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.continew.starter.core.constant;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 配置属性相关常量
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.1.1
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class PropertiesConstants {
|
||||
|
||||
/**
|
||||
* ContiNew Starter
|
||||
*/
|
||||
public static final String CONTINEW_STARTER = "continew-starter";
|
||||
|
||||
/**
|
||||
* 启用配置
|
||||
*/
|
||||
public static final String ENABLED = "enabled";
|
||||
|
||||
/**
|
||||
* 跨域配置
|
||||
*/
|
||||
public static final String CORS = CONTINEW_STARTER + ".cors";
|
||||
|
||||
/**
|
||||
* 线程池配置
|
||||
*/
|
||||
public static final String THREAD_POOL = CONTINEW_STARTER + ".thread-pool";
|
||||
|
||||
/**
|
||||
* 日志配置
|
||||
*/
|
||||
public static final String LOG = CONTINEW_STARTER + ".log";
|
||||
|
||||
/**
|
||||
* 存储配置
|
||||
*/
|
||||
public static final String STORAGE = CONTINEW_STARTER + ".storage";
|
||||
|
||||
/**
|
||||
* 本地存储配置
|
||||
*/
|
||||
public static final String STORAGE_LOCAL = STORAGE + ".local";
|
||||
|
||||
/**
|
||||
* 验证码配置
|
||||
*/
|
||||
public static final String CAPTCHA = CONTINEW_STARTER + ".captcha";
|
||||
|
||||
/**
|
||||
* 图形验证码配置
|
||||
*/
|
||||
public static final String CAPTCHA_GRAPHIC = CAPTCHA + ".graphic";
|
||||
|
||||
/**
|
||||
* 行为验证码配置
|
||||
*/
|
||||
public static final String CAPTCHA_BEHAVIOR = CAPTCHA + ".behavior";
|
||||
}
|
@@ -27,7 +27,11 @@ import org.springframework.lang.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 通用配置文件读取工厂(DefaultPropertySourceFactory 仅支持 properties 配置文件读取,详见:<a href="https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-yaml-shortcomings">YAML Shortcomings</a>)
|
||||
* 通用配置文件读取工厂
|
||||
* <p>
|
||||
* DefaultPropertySourceFactory 仅支持 properties
|
||||
* 配置文件读取,详见:<ahref="https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-yaml-shortcomings">YAMLShortcomings</a>
|
||||
* </p>
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
@@ -35,7 +39,8 @@ import java.io.IOException;
|
||||
public class GeneralPropertySourceFactory extends DefaultPropertySourceFactory {
|
||||
|
||||
@Override
|
||||
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource encodedResource) throws IOException {
|
||||
public PropertySource<?> createPropertySource(@Nullable String name,
|
||||
EncodedResource encodedResource) throws IOException {
|
||||
Resource resource = encodedResource.getResource();
|
||||
String resourceName = resource.getFilename();
|
||||
if (StrUtil.isNotBlank(resourceName) && StrUtil.endWithAny(resourceName, ".yml", ".yaml")) {
|
||||
|
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
* <p>
|
||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.continew.starter.core.util;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.TypeUtil;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* 类工具类
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.1.1
|
||||
*/
|
||||
public class ClassUtils {
|
||||
|
||||
/**
|
||||
* 获得给定类的所有泛型参数
|
||||
*
|
||||
* @param clazz 被检查的类,必须是已经确定泛型类型的类
|
||||
* @return {@link Class}[]
|
||||
*/
|
||||
public static Class<?>[] getTypeArguments(Class<?> clazz) {
|
||||
final Type[] typeArguments = TypeUtil.getTypeArguments(clazz);
|
||||
if (ArrayUtil.isEmpty(typeArguments)) {
|
||||
return new Class[0];
|
||||
}
|
||||
final Class<?>[] classes = new Class<?>[typeArguments.length];
|
||||
for (int i = 0; i < typeArguments.length; i++) {
|
||||
classes[i] = TypeUtil.getClass(typeArguments[i]);
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
}
|
@@ -53,8 +53,8 @@ public class FileUploadUtils {
|
||||
|
||||
String fileName;
|
||||
if (isKeepOriginalFilename) {
|
||||
fileName = String.format("%s-%s.%s", FileNameUtil.getPrefix(originalFilename),
|
||||
DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_MS_PATTERN), extensionName);
|
||||
fileName = String.format("%s-%s.%s", FileNameUtil.getPrefix(originalFilename), DateUtil.format(LocalDateTime
|
||||
.now(), DatePattern.PURE_DATETIME_MS_PATTERN), extensionName);
|
||||
} else {
|
||||
fileName = String.format("%s.%s", IdUtil.fastSimpleUUID(), extensionName);
|
||||
}
|
||||
|
@@ -120,6 +120,6 @@ public class ServletUtils {
|
||||
}
|
||||
|
||||
private static ServletRequestAttributes getServletRequestAttributes() {
|
||||
return (ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes());
|
||||
return (ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes());
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
* <p>
|
||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.continew.starter.core.util;
|
||||
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import jakarta.servlet.ServletContext;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.accept.ContentNegotiationManager;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||
import org.springframework.web.util.UrlPathHelper;
|
||||
import top.charles7c.continew.starter.core.constant.StringConstants;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Spring 工具类
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.1.1
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class SpringUtils {
|
||||
|
||||
/**
|
||||
* 取消注册静态资源映射
|
||||
*
|
||||
* @param handlerMap 静态资源映射
|
||||
*/
|
||||
public static void deRegisterResourceHandler(Map<String, String> handlerMap) {
|
||||
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
|
||||
// 获取已经注册的映射
|
||||
final HandlerMapping resourceHandlerMapping = applicationContext
|
||||
.getBean("resourceHandlerMapping", HandlerMapping.class);
|
||||
final Map<String, Object> oldHandlerMap = (Map<String, Object>)ReflectUtil
|
||||
.getFieldValue(resourceHandlerMapping, "handlerMap");
|
||||
// 移除之前注册的映射
|
||||
for (Map.Entry<String, String> entry : handlerMap.entrySet()) {
|
||||
String pathPattern = StrUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN);
|
||||
oldHandlerMap.remove(pathPattern);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册静态资源映射
|
||||
*
|
||||
* @param handlerMap 静态资源映射
|
||||
*/
|
||||
public static void registerResourceHandler(Map<String, String> handlerMap) {
|
||||
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
|
||||
// 获取已经注册的映射
|
||||
final HandlerMapping resourceHandlerMapping = applicationContext
|
||||
.getBean("resourceHandlerMapping", HandlerMapping.class);
|
||||
final Map<String, Object> oldHandlerMap = (Map<String, Object>)ReflectUtil
|
||||
.getFieldValue(resourceHandlerMapping, "handlerMap");
|
||||
// 重新注册映射
|
||||
final ServletContext servletContext = applicationContext.getBean(ServletContext.class);
|
||||
final ContentNegotiationManager contentNegotiationManager = applicationContext
|
||||
.getBean("mvcContentNegotiationManager", ContentNegotiationManager.class);
|
||||
final UrlPathHelper urlPathHelper = applicationContext.getBean("mvcUrlPathHelper", UrlPathHelper.class);
|
||||
final ResourceHandlerRegistry resourceHandlerRegistry = new ResourceHandlerRegistry(applicationContext, servletContext, contentNegotiationManager, urlPathHelper);
|
||||
for (Map.Entry<String, String> entry : handlerMap.entrySet()) {
|
||||
// 移除之前注册的映射
|
||||
String pathPattern = StrUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN);
|
||||
oldHandlerMap.remove(pathPattern);
|
||||
// 重新注册映射
|
||||
String resourceLocations = StrUtil.appendIfMissing(entry.getValue(), StringConstants.SLASH);
|
||||
resourceHandlerRegistry.addResourceHandler(pathPattern).addResourceLocations("file:" + resourceLocations);
|
||||
}
|
||||
final Map<String, ?> additionalUrlMap = ReflectUtil
|
||||
.<SimpleUrlHandlerMapping>invoke(resourceHandlerRegistry, "getHandlerMapping")
|
||||
.getUrlMap();
|
||||
ReflectUtil.<Void>invoke(resourceHandlerMapping, "registerHandlers", additionalUrlMap);
|
||||
}
|
||||
}
|
@@ -56,8 +56,8 @@ public class TemplateUtils {
|
||||
* @return 渲染后的内容
|
||||
*/
|
||||
public static String render(String parentPath, String templatePath, Map<?, ?> bindingMap) {
|
||||
TemplateEngine engine =
|
||||
TemplateUtil.createEngine(new TemplateConfig(parentPath, TemplateConfig.ResourceMode.CLASSPATH));
|
||||
TemplateEngine engine = TemplateUtil
|
||||
.createEngine(new TemplateConfig(parentPath, TemplateConfig.ResourceMode.CLASSPATH));
|
||||
Template template = engine.getTemplate(templatePath);
|
||||
return template.render(bindingMap);
|
||||
}
|
||||
|
@@ -47,8 +47,8 @@ public class CheckUtils extends Validator {
|
||||
* @param fieldValue 字段值
|
||||
*/
|
||||
public static void throwIfNotExists(Object obj, String entityName, String fieldName, Object fieldValue) {
|
||||
String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue,
|
||||
StrUtil.replace(entityName, "DO", StringConstants.EMPTY));
|
||||
String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue, StrUtil
|
||||
.replace(entityName, "DO", StringConstants.EMPTY));
|
||||
throwIfNull(obj, message, EXCEPTION_TYPE);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,9 @@ public class CheckUtils extends Validator {
|
||||
* @param template 异常信息模板,被替换的部分用 {} 表示,如果模板为 null,返回 "null"
|
||||
* @param params 参数值
|
||||
*/
|
||||
public static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String template,
|
||||
public static void throwIfNotEqualIgnoreCase(CharSequence str1,
|
||||
CharSequence str2,
|
||||
String template,
|
||||
Object... params) {
|
||||
throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE);
|
||||
}
|
||||
|
@@ -147,7 +147,9 @@ public class ValidationUtils extends Validator {
|
||||
* @param template 异常信息模板,被替换的部分用 {} 表示,如果模板为 null,返回 "null"
|
||||
* @param params 参数值
|
||||
*/
|
||||
public static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String template,
|
||||
public static void throwIfNotEqualIgnoreCase(CharSequence str1,
|
||||
CharSequence str2,
|
||||
String template,
|
||||
Object... params) {
|
||||
throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE);
|
||||
}
|
||||
|
@@ -86,7 +86,8 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIfBlank(CharSequence str, String message,
|
||||
protected static void throwIfBlank(CharSequence str,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
throwIf(StrUtil.isBlank(str), message, exceptionType);
|
||||
}
|
||||
@@ -98,7 +99,8 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIfNotBlank(CharSequence str, String message,
|
||||
protected static void throwIfNotBlank(CharSequence str,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
throwIf(StrUtil.isNotBlank(str), message, exceptionType);
|
||||
}
|
||||
@@ -111,7 +113,9 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIfEqual(Object obj1, Object obj2, String message,
|
||||
protected static void throwIfEqual(Object obj1,
|
||||
Object obj2,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
throwIf(ObjectUtil.equal(obj1, obj2), message, exceptionType);
|
||||
}
|
||||
@@ -124,7 +128,9 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIfNotEqual(Object obj1, Object obj2, String message,
|
||||
protected static void throwIfNotEqual(Object obj1,
|
||||
Object obj2,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
throwIf(ObjectUtil.notEqual(obj1, obj2), message, exceptionType);
|
||||
}
|
||||
@@ -137,7 +143,9 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIfEqualIgnoreCase(CharSequence str1, CharSequence str2, String message,
|
||||
protected static void throwIfEqualIgnoreCase(CharSequence str1,
|
||||
CharSequence str2,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
throwIf(StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType);
|
||||
}
|
||||
@@ -150,7 +158,9 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String message,
|
||||
protected static void throwIfNotEqualIgnoreCase(CharSequence str1,
|
||||
CharSequence str2,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
throwIf(!StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType);
|
||||
}
|
||||
@@ -176,7 +186,8 @@ public class Validator {
|
||||
* @param message 错误信息
|
||||
* @param exceptionType 异常类型
|
||||
*/
|
||||
protected static void throwIf(BooleanSupplier conditionSupplier, String message,
|
||||
protected static void throwIf(BooleanSupplier conditionSupplier,
|
||||
String message,
|
||||
Class<? extends RuntimeException> exceptionType) {
|
||||
if (null != conditionSupplier && conditionSupplier.getAsBoolean()) {
|
||||
log.error(message);
|
||||
|
@@ -27,7 +27,8 @@ import java.lang.annotation.*;
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Documented
|
||||
@ConditionalOnProperty(prefix = "mybatis-plus.extension.data-permission", name = "enabled", havingValue = "true")
|
||||
public @interface ConditionalOnEnabledDataPermission {}
|
||||
public @interface ConditionalOnEnabledDataPermission {
|
||||
}
|
@@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
|
||||
/**
|
||||
* MyBatis Plus 扩展配置属性
|
||||
*
|
||||
|
@@ -39,7 +39,6 @@ import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter;
|
||||
import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionHandlerImpl;
|
||||
|
||||
|
||||
/**
|
||||
* MyBatis Plus 自动配置
|
||||
*
|
||||
@@ -63,9 +62,11 @@ public class MybatisPlusAutoConfiguration {
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(MyBatisPlusExtensionProperties properties) {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 数据权限插件
|
||||
MyBatisPlusExtensionProperties.DataPermissionProperties dataPermissionProperties = properties.getDataPermission();
|
||||
MyBatisPlusExtensionProperties.DataPermissionProperties dataPermissionProperties = properties
|
||||
.getDataPermission();
|
||||
if (null != dataPermissionProperties && dataPermissionProperties.isEnabled()) {
|
||||
interceptor.addInnerInterceptor(new DataPermissionInterceptor(SpringUtil.getBean(DataPermissionHandler.class)));
|
||||
interceptor.addInnerInterceptor(new DataPermissionInterceptor(SpringUtil
|
||||
.getBean(DataPermissionHandler.class)));
|
||||
}
|
||||
// 分页插件
|
||||
MyBatisPlusExtensionProperties.PaginationProperties paginationProperties = properties.getPagination();
|
||||
@@ -105,8 +106,8 @@ public class MybatisPlusAutoConfiguration {
|
||||
private PaginationInnerInterceptor paginationInnerInterceptor(MyBatisPlusExtensionProperties.PaginationProperties paginationProperties) {
|
||||
// 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = null != paginationProperties.getDbType()
|
||||
? new PaginationInnerInterceptor(paginationProperties.getDbType())
|
||||
: new PaginationInnerInterceptor();
|
||||
? new PaginationInnerInterceptor(paginationProperties.getDbType())
|
||||
: new PaginationInnerInterceptor();
|
||||
paginationInnerInterceptor.setOverflow(paginationProperties.isOverflow());
|
||||
paginationInnerInterceptor.setMaxLimit(paginationProperties.getMaxLimit());
|
||||
return paginationInnerInterceptor;
|
||||
@@ -114,6 +115,6 @@ public class MybatisPlusAutoConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'MyBatis Plus' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'MyBatis Plus' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -107,6 +107,6 @@ public interface BaseMapper<T> extends com.baomidou.mybatisplus.core.mapper.Base
|
||||
* @return 实体类 Class 对象
|
||||
*/
|
||||
default Class<T> currentEntityClass() {
|
||||
return (Class<T>) ClassUtil.getTypeArgument(this.getClass(), 0);
|
||||
return (Class<T>)ClassUtil.getTypeArgument(this.getClass(), 0);
|
||||
}
|
||||
}
|
||||
|
@@ -59,14 +59,14 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
|
||||
@Override
|
||||
public Expression getSqlSegment(Expression where, String mappedStatementId) {
|
||||
try {
|
||||
Class<?> clazz =
|
||||
Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(StringConstants.DOT)));
|
||||
Class<?> clazz = Class.forName(mappedStatementId.substring(0, mappedStatementId
|
||||
.lastIndexOf(StringConstants.DOT)));
|
||||
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringConstants.DOT) + 1);
|
||||
Method[] methodArr = clazz.getMethods();
|
||||
for (Method method : methodArr) {
|
||||
DataPermission dataPermission = method.getAnnotation(DataPermission.class);
|
||||
if (null != dataPermission
|
||||
&& (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName))) {
|
||||
if (null != dataPermission && (method.getName().equals(methodName) || (method.getName() + "_COUNT")
|
||||
.equals(methodName))) {
|
||||
if (dataPermissionFilter.isFilter()) {
|
||||
return buildDataScopeFilter(dataPermission, where);
|
||||
}
|
||||
@@ -81,10 +81,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
|
||||
/**
|
||||
* 构建数据范围过滤条件
|
||||
*
|
||||
* @param dataPermission
|
||||
* 数据权限
|
||||
* @param where
|
||||
* 当前查询条件
|
||||
* @param dataPermission 数据权限
|
||||
* @param where 当前查询条件
|
||||
* @return 构建后查询条件
|
||||
*/
|
||||
private Expression buildDataScopeFilter(DataPermission dataPermission, Expression where) {
|
||||
@@ -112,7 +110,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
|
||||
equalsTo.setRightExpression(new LongValue(currentUser.getDeptId()));
|
||||
Function function = new Function();
|
||||
function.setName("find_in_set");
|
||||
function.setParameters(new ExpressionList(new LongValue(currentUser.getDeptId()), new Column("ancestors")));
|
||||
function.setParameters(new ExpressionList(new LongValue(currentUser
|
||||
.getDeptId()), new Column("ancestors")));
|
||||
select.setWhere(new OrExpression(equalsTo, function));
|
||||
subSelect.setSelectBody(select);
|
||||
// 构建父查询
|
||||
@@ -158,10 +157,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
|
||||
/**
|
||||
* 构建 Column
|
||||
*
|
||||
* @param tableAlias
|
||||
* 表别名
|
||||
* @param columnName
|
||||
* 字段名称
|
||||
* @param tableAlias 表别名
|
||||
* @param columnName 字段名称
|
||||
* @return 带表别名字段
|
||||
*/
|
||||
private Column buildColumn(String tableAlias, String columnName) {
|
||||
|
@@ -90,8 +90,8 @@ public class QueryHelper {
|
||||
// 解析查询条件
|
||||
parse(queryAnnotation, field.getName(), fieldValue, queryWrapper);
|
||||
} catch (BadRequestException e) {
|
||||
log.error("Build query occurred an validation error: {}. Query: {}, Field: {}.", e.getMessage(), query,
|
||||
field, e);
|
||||
log.error("Build query occurred an validation error: {}. Query: {}, Field: {}.", e
|
||||
.getMessage(), query, field, e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("Build query occurred an error: {}. Query: {}, Field: {}.", e.getMessage(), query, field, e);
|
||||
@@ -109,7 +109,9 @@ public class QueryHelper {
|
||||
* @param queryWrapper MyBatis Plus 查询条件封装对象
|
||||
* @param <R> 查询数据类型
|
||||
*/
|
||||
private static <R> void parse(Query queryAnnotation, String fieldName, Object fieldValue,
|
||||
private static <R> void parse(Query queryAnnotation,
|
||||
String fieldName,
|
||||
Object fieldValue,
|
||||
QueryWrapper<R> queryWrapper) {
|
||||
// 解析多属性模糊查询
|
||||
// 如果设置了多属性模糊查询,分割属性进行条件拼接
|
||||
@@ -137,7 +139,7 @@ public class QueryHelper {
|
||||
case GREATER_THAN_OR_EQUAL -> queryWrapper.ge(columnName, fieldValue);
|
||||
case LESS_THAN_OR_EQUAL -> queryWrapper.le(columnName, fieldValue);
|
||||
case BETWEEN -> {
|
||||
List<Object> between = new ArrayList<>((List<Object>) fieldValue);
|
||||
List<Object> between = new ArrayList<>((List<Object>)fieldValue);
|
||||
ValidationUtils.throwIf(between.size() != 2, "[{}] 必须是一个范围", fieldName);
|
||||
queryWrapper.between(columnName, between.get(0), between.get(1));
|
||||
}
|
||||
@@ -146,11 +148,11 @@ public class QueryHelper {
|
||||
case RIGHT_LIKE -> queryWrapper.likeRight(columnName, fieldValue);
|
||||
case IN -> {
|
||||
ValidationUtils.throwIfEmpty(fieldValue, "[{}] 不能为空", fieldName);
|
||||
queryWrapper.in(columnName, (List<Object>) fieldValue);
|
||||
queryWrapper.in(columnName, (List<Object>)fieldValue);
|
||||
}
|
||||
case NOT_IN -> {
|
||||
ValidationUtils.throwIfEmpty(fieldValue, "[{}] 不能为空", fieldName);
|
||||
queryWrapper.notIn(columnName, (List<Object>) fieldValue);
|
||||
queryWrapper.notIn(columnName, (List<Object>)fieldValue);
|
||||
}
|
||||
case IS_NULL -> queryWrapper.isNull(columnName);
|
||||
case IS_NOT_NULL -> queryWrapper.isNotNull(columnName);
|
||||
|
@@ -84,8 +84,7 @@ public enum QueryType {
|
||||
/**
|
||||
* 非空查询,例如:WHERE `email` IS NOT NULL
|
||||
*/
|
||||
IS_NOT_NULL(14, "IS NOT NULL"),
|
||||
;
|
||||
IS_NOT_NULL(14, "IS NOT NULL"),;
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
@@ -54,7 +54,7 @@
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<revision>1.1.0</revision>
|
||||
<revision>1.1.1</revision>
|
||||
<just-auth.version>1.16.6</just-auth.version>
|
||||
<sa-token.version>1.37.0</sa-token.version>
|
||||
<mybatis-plus.version>3.5.5</mybatis-plus.version>
|
||||
|
@@ -50,15 +50,14 @@ public class CrudAutoConfiguration extends DelegatingWebMvcConfiguration {
|
||||
@Bean
|
||||
@Primary
|
||||
@Override
|
||||
public RequestMappingHandlerMapping requestMappingHandlerMapping(
|
||||
@Qualifier("mvcContentNegotiationManager") ContentNegotiationManager contentNegotiationManager,
|
||||
@Qualifier("mvcConversionService") FormattingConversionService conversionService,
|
||||
@Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider) {
|
||||
public RequestMappingHandlerMapping requestMappingHandlerMapping(@Qualifier("mvcContentNegotiationManager") ContentNegotiationManager contentNegotiationManager,
|
||||
@Qualifier("mvcConversionService") FormattingConversionService conversionService,
|
||||
@Qualifier("mvcResourceUrlProvider") ResourceUrlProvider resourceUrlProvider) {
|
||||
return super.requestMappingHandlerMapping(contentNegotiationManager, conversionService, resourceUrlProvider);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Extension-CRUD' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Extension-CRUD' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMappi
|
||||
import top.charles7c.continew.starter.extension.crud.enums.Api;
|
||||
import top.charles7c.continew.starter.extension.crud.model.query.PageQuery;
|
||||
import top.charles7c.continew.starter.extension.crud.model.query.SortQuery;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.PageResp;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.R;
|
||||
|
||||
import java.util.List;
|
||||
@@ -64,10 +64,9 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Operation(summary = "分页查询列表", description = "分页查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping
|
||||
public R<PageDataResp<L>> page(Q query, @Validated PageQuery pageQuery) {
|
||||
public R<PageResp<L>> page(Q query, @Validated PageQuery pageQuery) {
|
||||
this.checkPermission(Api.LIST);
|
||||
PageDataResp<L> pageData = baseService.page(query, pageQuery);
|
||||
return R.ok(pageData);
|
||||
return R.ok(baseService.page(query, pageQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,8 +81,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@GetMapping("/tree")
|
||||
public R<List<Tree<Long>>> tree(Q query, SortQuery sortQuery) {
|
||||
this.checkPermission(Api.LIST);
|
||||
List<Tree<Long>> list = baseService.tree(query, sortQuery, false);
|
||||
return R.ok(list);
|
||||
return R.ok(baseService.tree(query, sortQuery, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,8 +96,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@GetMapping("/list")
|
||||
public R<List<L>> list(Q query, SortQuery sortQuery) {
|
||||
this.checkPermission(Api.LIST);
|
||||
List<L> list = baseService.list(query, sortQuery);
|
||||
return R.ok(list);
|
||||
return R.ok(baseService.list(query, sortQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,8 +111,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@GetMapping("/{id}")
|
||||
public R<D> get(@PathVariable Long id) {
|
||||
this.checkPermission(Api.LIST);
|
||||
D detail = baseService.get(id);
|
||||
return R.ok(detail);
|
||||
return R.ok(baseService.get(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,8 +125,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@PostMapping
|
||||
public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C req) {
|
||||
this.checkPermission(Api.ADD);
|
||||
Long id = baseService.add(req);
|
||||
return R.ok("新增成功", id);
|
||||
return R.ok("新增成功", baseService.add(req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -34,7 +35,7 @@ import java.time.LocalDateTime;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BaseDetailResp extends BaseResp {
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -20,7 +20,7 @@ import cn.hutool.core.lang.tree.Tree;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import top.charles7c.continew.starter.extension.crud.model.query.PageQuery;
|
||||
import top.charles7c.continew.starter.extension.crud.model.query.SortQuery;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.PageResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface BaseService<L, D, Q, C extends BaseReq> {
|
||||
* @param pageQuery 分页查询条件
|
||||
* @return 分页列表信息
|
||||
*/
|
||||
PageDataResp<L> page(Q query, PageQuery pageQuery);
|
||||
PageResp<L> page(Q query, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询树列表
|
||||
@@ -64,6 +64,15 @@ public interface BaseService<L, D, Q, C extends BaseReq> {
|
||||
*/
|
||||
List<L> list(Q query, SortQuery sortQuery);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @return 列表信息
|
||||
*/
|
||||
default List<L> list() {
|
||||
return list(null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
*
|
||||
|
@@ -33,6 +33,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import top.charles7c.continew.starter.core.util.ClassUtils;
|
||||
import top.charles7c.continew.starter.core.util.ExceptionUtils;
|
||||
import top.charles7c.continew.starter.core.util.ReflectUtils;
|
||||
import top.charles7c.continew.starter.core.util.validate.CheckUtils;
|
||||
@@ -41,7 +42,7 @@ import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper;
|
||||
import top.charles7c.continew.starter.extension.crud.annotation.TreeField;
|
||||
import top.charles7c.continew.starter.extension.crud.model.query.PageQuery;
|
||||
import top.charles7c.continew.starter.extension.crud.model.query.SortQuery;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp;
|
||||
import top.charles7c.continew.starter.extension.crud.model.resp.PageResp;
|
||||
import top.charles7c.continew.starter.extension.crud.util.TreeUtils;
|
||||
import top.charles7c.continew.starter.file.excel.util.ExcelUtils;
|
||||
|
||||
@@ -61,29 +62,23 @@ import java.util.List;
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO, L, D, Q, C extends BaseReq>
|
||||
implements BaseService<L, D, Q, C> {
|
||||
public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO, L, D, Q, C extends BaseReq> implements BaseService<L, D, Q, C> {
|
||||
|
||||
@Autowired
|
||||
protected M baseMapper;
|
||||
|
||||
private final Class<T> entityClass;
|
||||
private final Class<L> listClass;
|
||||
private final Class<D> detailClass;
|
||||
|
||||
protected BaseServiceImpl() {
|
||||
this.entityClass = (Class<T>) ClassUtil.getTypeArgument(this.getClass(), 1);
|
||||
this.listClass = (Class<L>) ClassUtil.getTypeArgument(this.getClass(), 2);
|
||||
this.detailClass = (Class<D>) ClassUtil.getTypeArgument(this.getClass(), 3);
|
||||
}
|
||||
private final Class<?>[] typeArguments = ClassUtils.getTypeArguments(this.getClass());
|
||||
protected final Class<T> entityClass = this.currentEntityClass();
|
||||
protected final Class<L> listClass = this.currentListClass();
|
||||
protected final Class<D> detailClass = this.currentDetailClass();
|
||||
|
||||
@Override
|
||||
public PageDataResp<L> page(Q query, PageQuery pageQuery) {
|
||||
public PageResp<L> page(Q query, PageQuery pageQuery) {
|
||||
QueryWrapper<T> queryWrapper = QueryHelper.build(query);
|
||||
IPage<T> page = baseMapper.selectPage(pageQuery.toPage(), queryWrapper);
|
||||
PageDataResp<L> pageDataResp = PageDataResp.build(page, listClass);
|
||||
pageDataResp.getList().forEach(this::fill);
|
||||
return pageDataResp;
|
||||
PageResp<L> pageResp = PageResp.build(page, listClass);
|
||||
pageResp.getList().forEach(this::fill);
|
||||
return pageResp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,10 +103,10 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
|
||||
tree.setWeight(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.weightKey())));
|
||||
if (!isSimple) {
|
||||
List<Field> fieldList = ReflectUtils.getNonStaticFields(listClass);
|
||||
fieldList.removeIf(f -> StrUtil.containsAnyIgnoreCase(f.getName(), treeField.value(),
|
||||
treeField.parentIdKey(), treeField.nameKey(), treeField.weightKey(), treeField.childrenKey()));
|
||||
fieldList
|
||||
.forEach(f -> tree.putExtra(f.getName(), ReflectUtil.invoke(node, StrUtil.genGetter(f.getName()))));
|
||||
fieldList.removeIf(f -> StrUtil.containsAnyIgnoreCase(f.getName(), treeField.value(), treeField
|
||||
.parentIdKey(), treeField.nameKey(), treeField.weightKey(), treeField.childrenKey()));
|
||||
fieldList.forEach(f -> tree.putExtra(f.getName(), ReflectUtil.invoke(node, StrUtil.genGetter(f
|
||||
.getName()))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -136,6 +131,9 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
|
||||
// 设置排序
|
||||
this.sort(queryWrapper, sortQuery);
|
||||
List<T> entityList = baseMapper.selectList(queryWrapper);
|
||||
if (entityClass == targetClass) {
|
||||
return (List<E>)entityList;
|
||||
}
|
||||
return BeanUtil.copyToList(entityList, targetClass);
|
||||
}
|
||||
|
||||
@@ -226,14 +224,41 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseDO,
|
||||
* @param detailObj 待填充详情信息
|
||||
*/
|
||||
public void fillDetail(Object detailObj) {
|
||||
if (detailObj instanceof BaseDetailResp detail) {
|
||||
this.fill(detail);
|
||||
Long updateUser = detail.getUpdateUser();
|
||||
if (detailObj instanceof BaseDetailResp detailResp) {
|
||||
this.fill(detailResp);
|
||||
Long updateUser = detailResp.getUpdateUser();
|
||||
if (null == updateUser) {
|
||||
return;
|
||||
}
|
||||
CommonUserService userService = SpringUtil.getBean(CommonUserService.class);
|
||||
detail.setUpdateUserString(ExceptionUtils.exToNull(() -> userService.getNicknameById(updateUser)));
|
||||
detailResp.setUpdateUserString(ExceptionUtils.exToNull(() -> userService.getNicknameById(updateUser)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前实体类型
|
||||
*
|
||||
* @return 当前实体类型
|
||||
*/
|
||||
protected Class<T> currentEntityClass() {
|
||||
return (Class<T>)this.typeArguments[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前列表信息类型
|
||||
*
|
||||
* @return 当前列表信息类型
|
||||
*/
|
||||
protected Class<L> currentListClass() {
|
||||
return (Class<L>)this.typeArguments[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前详情信息类型
|
||||
*
|
||||
* @return 当前详情信息类型
|
||||
*/
|
||||
protected Class<D> currentDetailClass() {
|
||||
return (Class<D>)this.typeArguments[3];
|
||||
}
|
||||
}
|
||||
|
@@ -60,7 +60,9 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
|
||||
return this.getMappingForMethodWrapper(method, handlerType, crudRequestMapping);
|
||||
}
|
||||
|
||||
private RequestMappingInfo getMappingForMethodWrapper(@NonNull Method method, @NonNull Class<?> handlerType, CrudRequestMapping crudRequestMapping) {
|
||||
private RequestMappingInfo getMappingForMethodWrapper(@NonNull Method method,
|
||||
@NonNull Class<?> handlerType,
|
||||
CrudRequestMapping crudRequestMapping) {
|
||||
RequestMappingInfo info = this.createRequestMappingInfo(method);
|
||||
if (null != info) {
|
||||
RequestMappingInfo typeInfo = this.createRequestMappingInfo(handlerType);
|
||||
@@ -79,8 +81,9 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
|
||||
|
||||
private RequestMappingInfo createRequestMappingInfo(AnnotatedElement element) {
|
||||
RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(element, RequestMapping.class);
|
||||
RequestCondition<?> condition = (element instanceof Class<?> clazz ?
|
||||
getCustomTypeCondition(clazz) : getCustomMethodCondition((Method) element));
|
||||
RequestCondition<?> condition = (element instanceof Class<?> clazz
|
||||
? getCustomTypeCondition(clazz)
|
||||
: getCustomMethodCondition((Method)element));
|
||||
return (requestMapping != null ? createRequestMappingInfo(requestMapping, condition) : null);
|
||||
}
|
||||
}
|
||||
|
@@ -51,18 +51,18 @@ public class GlobalErrorHandler extends BasicErrorController {
|
||||
@Resource
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
public GlobalErrorHandler(ErrorAttributes errorAttributes, ServerProperties serverProperties,
|
||||
public GlobalErrorHandler(ErrorAttributes errorAttributes,
|
||||
ServerProperties serverProperties,
|
||||
List<ErrorViewResolver> errorViewResolvers) {
|
||||
super(errorAttributes, serverProperties.getError(), errorViewResolvers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
|
||||
Map<String, Object> errorAttributeMap =
|
||||
super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.TEXT_HTML));
|
||||
String path = (String) errorAttributeMap.get("path");
|
||||
Map<String, Object> errorAttributeMap = super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.TEXT_HTML));
|
||||
String path = (String)errorAttributeMap.get("path");
|
||||
HttpStatus status = super.getStatus(request);
|
||||
R<Object> result = R.fail(status.value(), (String) errorAttributeMap.get("error"));
|
||||
R<Object> result = R.fail(status.value(), (String)errorAttributeMap.get("error"));
|
||||
result.setData(path);
|
||||
try {
|
||||
response.setStatus(HttpStatus.OK.value());
|
||||
@@ -77,11 +77,10 @@ public class GlobalErrorHandler extends BasicErrorController {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
|
||||
Map<String, Object> errorAttributeMap =
|
||||
super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.ALL));
|
||||
String path = (String) errorAttributeMap.get("path");
|
||||
Map<String, Object> errorAttributeMap = super.getErrorAttributes(request, super.getErrorAttributeOptions(request, MediaType.ALL));
|
||||
String path = (String)errorAttributeMap.get("path");
|
||||
HttpStatus status = super.getStatus(request);
|
||||
R<Object> result = R.fail(status.value(), (String) errorAttributeMap.get("error"));
|
||||
R<Object> result = R.fail(status.value(), (String)errorAttributeMap.get("error"));
|
||||
result.setData(path);
|
||||
log.error("请求地址 [{}],发生错误,错误信息:{}。", path, JSONUtil.toJsonStr(errorAttributeMap));
|
||||
return new ResponseEntity<>(BeanUtil.beanToMap(result), HttpStatus.OK);
|
||||
|
@@ -68,8 +68,8 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(ConstraintViolationException.class)
|
||||
public R constraintViolationException(ConstraintViolationException e, HttpServletRequest request) {
|
||||
log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e);
|
||||
String errorMsg =
|
||||
CollUtil.join(e.getConstraintViolations(), StringConstants.CHINESE_COMMA, ConstraintViolation::getMessage);
|
||||
String errorMsg = CollUtil.join(e
|
||||
.getConstraintViolations(), StringConstants.CHINESE_COMMA, ConstraintViolation::getMessage);
|
||||
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(BindException.class)
|
||||
public R handleBindException(BindException e, HttpServletRequest request) {
|
||||
log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e);
|
||||
String errorMsg = CollUtil.join(e.getAllErrors(), StringConstants.CHINESE_COMMA,
|
||||
DefaultMessageSourceResolvable::getDefaultMessage);
|
||||
String errorMsg = CollUtil.join(e
|
||||
.getAllErrors(), StringConstants.CHINESE_COMMA, DefaultMessageSourceResolvable::getDefaultMessage);
|
||||
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e, HttpServletRequest request) {
|
||||
log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e);
|
||||
String errorMsg = ExceptionUtils
|
||||
.exToNull(() -> Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage());
|
||||
String errorMsg = ExceptionUtils.exToNull(() -> Objects.requireNonNull(e.getBindingResult().getFieldError())
|
||||
.getDefaultMessage());
|
||||
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||
public R handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e,
|
||||
HttpServletRequest request) {
|
||||
HttpServletRequest request) {
|
||||
String errorMsg = StrUtil.format("参数名:[{}],期望参数类型:[{}]", e.getName(), e.getParameter().getParameterType());
|
||||
log.warn("请求地址 [{}],参数转换失败,{}。", request.getRequestURI(), errorMsg, e);
|
||||
return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg);
|
||||
|
@@ -62,8 +62,8 @@ public class SortQuery implements Serializable {
|
||||
// e.g "sort=createTime,desc&sort=name,asc"
|
||||
for (String s : sort) {
|
||||
List<String> sortList = StrUtil.splitTrim(s, StringConstants.COMMA);
|
||||
Sort.Order order =
|
||||
new Sort.Order(Sort.Direction.valueOf(sortList.get(1).toUpperCase()), sortList.get(0));
|
||||
Sort.Order order = new Sort.Order(Sort.Direction.valueOf(sortList.get(1).toUpperCase()), sortList
|
||||
.get(0));
|
||||
orders.add(order);
|
||||
}
|
||||
} else {
|
||||
|
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "分页信息")
|
||||
public class PageDataResp<L> implements Serializable {
|
||||
public class PageResp<L> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -62,14 +62,14 @@ public class PageDataResp<L> implements Serializable {
|
||||
* @param <L> 目标列表数据类型
|
||||
* @return 分页信息
|
||||
*/
|
||||
public static <T, L> PageDataResp<L> build(IPage<T> page, Class<L> targetClass) {
|
||||
public static <T, L> PageResp<L> build(IPage<T> page, Class<L> targetClass) {
|
||||
if (null == page) {
|
||||
return empty();
|
||||
}
|
||||
PageDataResp<L> pageDataResp = new PageDataResp<>();
|
||||
pageDataResp.setList(BeanUtil.copyToList(page.getRecords(), targetClass));
|
||||
pageDataResp.setTotal(page.getTotal());
|
||||
return pageDataResp;
|
||||
PageResp<L> pageResp = new PageResp<>();
|
||||
pageResp.setList(BeanUtil.copyToList(page.getRecords(), targetClass));
|
||||
pageResp.setTotal(page.getTotal());
|
||||
return pageResp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,14 +79,14 @@ public class PageDataResp<L> implements Serializable {
|
||||
* @param <L> 列表数据类型
|
||||
* @return 分页信息
|
||||
*/
|
||||
public static <L> PageDataResp<L> build(IPage<L> page) {
|
||||
public static <L> PageResp<L> build(IPage<L> page) {
|
||||
if (null == page) {
|
||||
return empty();
|
||||
}
|
||||
PageDataResp<L> pageDataResp = new PageDataResp<>();
|
||||
pageDataResp.setList(page.getRecords());
|
||||
pageDataResp.setTotal(page.getTotal());
|
||||
return pageDataResp;
|
||||
PageResp<L> pageResp = new PageResp<>();
|
||||
pageResp.setList(page.getRecords());
|
||||
pageResp.setTotal(page.getTotal());
|
||||
return pageResp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,23 +98,23 @@ public class PageDataResp<L> implements Serializable {
|
||||
* @param <L> 列表数据类型
|
||||
* @return 分页信息
|
||||
*/
|
||||
public static <L> PageDataResp<L> build(int page, int size, List<L> list) {
|
||||
public static <L> PageResp<L> build(int page, int size, List<L> list) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return empty();
|
||||
}
|
||||
PageDataResp<L> pageDataResp = new PageDataResp<>();
|
||||
pageDataResp.setTotal(list.size());
|
||||
PageResp<L> pageResp = new PageResp<>();
|
||||
pageResp.setTotal(list.size());
|
||||
// 对列表数据进行分页
|
||||
int fromIndex = (page - 1) * size;
|
||||
int toIndex = page * size + size;
|
||||
if (fromIndex > list.size()) {
|
||||
pageDataResp.setList(new ArrayList<>(0));
|
||||
pageResp.setList(new ArrayList<>(0));
|
||||
} else if (toIndex >= list.size()) {
|
||||
pageDataResp.setList(list.subList(fromIndex, list.size()));
|
||||
pageResp.setList(list.subList(fromIndex, list.size()));
|
||||
} else {
|
||||
pageDataResp.setList(list.subList(fromIndex, toIndex));
|
||||
pageResp.setList(list.subList(fromIndex, toIndex));
|
||||
}
|
||||
return pageDataResp;
|
||||
return pageResp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,9 +123,9 @@ public class PageDataResp<L> implements Serializable {
|
||||
* @param <L> 列表数据类型
|
||||
* @return 分页信息
|
||||
*/
|
||||
private static <L> PageDataResp<L> empty() {
|
||||
PageDataResp<L> pageDataResp = new PageDataResp<>();
|
||||
pageDataResp.setList(new ArrayList<>(0));
|
||||
return pageDataResp;
|
||||
private static <L> PageResp<L> empty() {
|
||||
PageResp<L> pageResp = new PageResp<>();
|
||||
pageResp.setList(new ArrayList<>(0));
|
||||
return pageResp;
|
||||
}
|
||||
}
|
@@ -42,8 +42,9 @@ public class TreeUtils {
|
||||
/**
|
||||
* 默认字段配置对象(根据前端树结构灵活调整名称)
|
||||
*/
|
||||
public static final TreeNodeConfig DEFAULT_CONFIG =
|
||||
TreeNodeConfig.DEFAULT_CONFIG.setNameKey("title").setIdKey("key").setWeightKey("sort");
|
||||
public static final TreeNodeConfig DEFAULT_CONFIG = TreeNodeConfig.DEFAULT_CONFIG.setNameKey("title")
|
||||
.setIdKey("key")
|
||||
.setWeightKey("sort");
|
||||
|
||||
/**
|
||||
* 树构建
|
||||
@@ -72,7 +73,7 @@ public class TreeUtils {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
E parentId = (E) ReflectUtil.getFieldValue(list.get(0), treeNodeConfig.getParentIdKey());
|
||||
E parentId = (E)ReflectUtil.getFieldValue(list.get(0), treeNodeConfig.getParentIdKey());
|
||||
return TreeUtil.build(list, parentId, treeNodeConfig, nodeParser);
|
||||
}
|
||||
|
||||
@@ -84,8 +85,11 @@ public class TreeUtils {
|
||||
*/
|
||||
public static TreeNodeConfig genTreeNodeConfig(TreeField treeField) {
|
||||
CheckUtils.throwIfNull(treeField, "请添加并配置 @TreeField 树结构信息");
|
||||
return new TreeNodeConfig().setIdKey(treeField.value()).setParentIdKey(treeField.parentIdKey())
|
||||
.setNameKey(treeField.nameKey()).setWeightKey(treeField.weightKey()).setChildrenKey(treeField.childrenKey())
|
||||
.setDeep(treeField.deep() < 0 ? null : treeField.deep());
|
||||
return new TreeNodeConfig().setIdKey(treeField.value())
|
||||
.setParentIdKey(treeField.parentIdKey())
|
||||
.setNameKey(treeField.nameKey())
|
||||
.setWeightKey(treeField.weightKey())
|
||||
.setChildrenKey(treeField.childrenKey())
|
||||
.setDeep(treeField.deep() < 0 ? null : treeField.deep());
|
||||
}
|
||||
}
|
||||
|
@@ -55,7 +55,8 @@ public class ExcelBigNumberConverter implements Converter<Long> {
|
||||
* 转换为 Java 数据(读取 Excel)
|
||||
*/
|
||||
@Override
|
||||
public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
|
||||
public Long convertToJavaData(ReadCellData<?> cellData,
|
||||
ExcelContentProperty contentProperty,
|
||||
GlobalConfiguration globalConfiguration) {
|
||||
return Convert.toLong(cellData.getData());
|
||||
}
|
||||
@@ -64,7 +65,8 @@ public class ExcelBigNumberConverter implements Converter<Long> {
|
||||
* 转换为 Excel 数据(写入 Excel)
|
||||
*/
|
||||
@Override
|
||||
public WriteCellData<Object> convertToExcelData(Long value, ExcelContentProperty contentProperty,
|
||||
public WriteCellData<Object> convertToExcelData(Long value,
|
||||
ExcelContentProperty contentProperty,
|
||||
GlobalConfiguration globalConfiguration) {
|
||||
if (null != value) {
|
||||
String str = Long.toString(value);
|
||||
|
@@ -62,19 +62,25 @@ public class ExcelUtils {
|
||||
* @param clazz 导出数据类型
|
||||
* @param response 响应对象
|
||||
*/
|
||||
public static <T> void export(List<T> list, String fileName, String sheetName, Class<T> clazz,
|
||||
public static <T> void export(List<T> list,
|
||||
String fileName,
|
||||
String sheetName,
|
||||
Class<T> clazz,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
fileName =
|
||||
String.format("%s_%s.xlsx", fileName, DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN));
|
||||
fileName = String.format("%s_%s.xlsx", fileName, DateUtil
|
||||
.format(new Date(), DatePattern.PURE_DATETIME_PATTERN));
|
||||
fileName = URLUtil.encode(fileName);
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
EasyExcel.write(response.getOutputStream(), clazz).autoCloseStream(false)
|
||||
// 自动适配宽度
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
// 自动转换大数值
|
||||
.registerConverter(new ExcelBigNumberConverter()).sheet(sheetName).doWrite(list);
|
||||
EasyExcel.write(response.getOutputStream(), clazz)
|
||||
.autoCloseStream(false)
|
||||
// 自动适配宽度
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
// 自动转换大数值
|
||||
.registerConverter(new ExcelBigNumberConverter())
|
||||
.sheet(sheetName)
|
||||
.doWrite(list);
|
||||
} catch (Exception e) {
|
||||
log.error("Export excel occurred an error: {}. fileName: {}.", e.getMessage(), fileName, e);
|
||||
throw new BaseException("导出 Excel 出现错误");
|
||||
|
@@ -72,7 +72,7 @@ public class JacksonAutoConfiguration {
|
||||
javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(timeFormatter));
|
||||
builder.timeZone(TimeZone.getDefault());
|
||||
builder.modules(javaTimeModule);
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Jackson' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Jackson' completed initialization.");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -84,8 +84,7 @@ public enum Include {
|
||||
/**
|
||||
* 响应参数(默认)
|
||||
*/
|
||||
RESPONSE_PARAM,
|
||||
;
|
||||
RESPONSE_PARAM,;
|
||||
|
||||
private static final Set<Include> DEFAULT_INCLUDES;
|
||||
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package top.charles7c.continew.starter.log.common.model;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import top.charles7c.continew.starter.log.common.enums.Include;
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package top.charles7c.continew.starter.log.httptracepro.autoconfigure;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@@ -27,7 +28,8 @@ import java.lang.annotation.*;
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Documented
|
||||
@ConditionalOnProperty(prefix = "continew-starter.log", name = "enabled", havingValue = "true")
|
||||
public @interface ConditionalOnEnabledLog {}
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.LOG, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
public @interface ConditionalOnEnabledLog {
|
||||
}
|
@@ -45,11 +45,11 @@ import top.charles7c.continew.starter.log.httptracepro.handler.LogInterceptor;
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
public class LogAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private final LogProperties properties;
|
||||
private final LogProperties logProperties;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new LogInterceptor(logDao(), properties));
|
||||
registry.addInterceptor(new LogInterceptor(logDao(), logProperties));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ public class LogAutoConfiguration implements WebMvcConfigurer {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public LogFilter logFilter() {
|
||||
return new LogFilter();
|
||||
return new LogFilter(logProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,6 +72,6 @@ public class LogAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Log-HttpTracePro' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Log-HttpTracePro' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package top.charles7c.continew.starter.log.httptracepro.autoconfigure;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
import top.charles7c.continew.starter.log.common.enums.Include;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -30,7 +31,7 @@ import java.util.Set;
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.log")
|
||||
@ConfigurationProperties(PropertiesConstants.LOG)
|
||||
public class LogProperties {
|
||||
|
||||
/**
|
||||
|
@@ -27,11 +27,14 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
||||
import org.springframework.web.util.ContentCachingRequestWrapper;
|
||||
import org.springframework.web.util.ContentCachingResponseWrapper;
|
||||
import org.springframework.web.util.WebUtils;
|
||||
import top.charles7c.continew.starter.log.common.enums.Include;
|
||||
import top.charles7c.continew.starter.log.httptracepro.autoconfigure.LogProperties;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 日志过滤器
|
||||
@@ -47,30 +50,43 @@ import java.util.Objects;
|
||||
@RequiredArgsConstructor
|
||||
public class LogFilter extends OncePerRequestFilter implements Ordered {
|
||||
|
||||
private final LogProperties logProperties;
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return Ordered.LOWEST_PRECEDENCE - 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
|
||||
protected void doFilterInternal(@NonNull HttpServletRequest request,
|
||||
@NonNull HttpServletResponse response,
|
||||
@NonNull FilterChain filterChain) throws ServletException, IOException {
|
||||
if (!isRequestValid(request)) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
// 包装输入、输出流,可重复读取
|
||||
if (!(request instanceof ContentCachingRequestWrapper)) {
|
||||
// 包装输入流,可重复读取
|
||||
if (isRequestWrapper(request)) {
|
||||
request = new ContentCachingRequestWrapper(request);
|
||||
}
|
||||
if (!(response instanceof ContentCachingResponseWrapper)) {
|
||||
// 包装输出流,可重复读取
|
||||
boolean isResponseWrapper = isResponseWrapper(response);
|
||||
if (isResponseWrapper) {
|
||||
response = new ContentCachingResponseWrapper(response);
|
||||
}
|
||||
filterChain.doFilter(request, response);
|
||||
// 更新响应(不操作这一步,会导致接口响应空白)
|
||||
updateResponse(response);
|
||||
if (isResponseWrapper) {
|
||||
updateResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求是否有效
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @return true:是;false:否
|
||||
*/
|
||||
private boolean isRequestValid(HttpServletRequest request) {
|
||||
try {
|
||||
new URI(request.getRequestURL().toString());
|
||||
@@ -80,9 +96,39 @@ public class LogFilter extends OncePerRequestFilter implements Ordered {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要包装输入流
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @return true:是;false:否
|
||||
*/
|
||||
private boolean isRequestWrapper(HttpServletRequest request) {
|
||||
Set<Include> includeSet = logProperties.getInclude();
|
||||
return !(request instanceof ContentCachingRequestWrapper) && (includeSet
|
||||
.contains(Include.REQUEST_BODY) || includeSet.contains(Include.REQUEST_PARAM));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要包装输出流
|
||||
*
|
||||
* @param response 响应对象
|
||||
* @return true:是;false:否
|
||||
*/
|
||||
private boolean isResponseWrapper(HttpServletResponse response) {
|
||||
Set<Include> includeSet = logProperties.getInclude();
|
||||
return !(response instanceof ContentCachingResponseWrapper) && (includeSet
|
||||
.contains(Include.RESPONSE_BODY) || includeSet.contains(Include.RESPONSE_PARAM));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新响应
|
||||
*
|
||||
* @param response 响应对象
|
||||
* @throws IOException /
|
||||
*/
|
||||
private void updateResponse(HttpServletResponse response) throws IOException {
|
||||
ContentCachingResponseWrapper responseWrapper =
|
||||
WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);
|
||||
ContentCachingResponseWrapper responseWrapper = WebUtils
|
||||
.getNativeResponse(response, ContentCachingResponseWrapper.class);
|
||||
Objects.requireNonNull(responseWrapper).copyBodyToResponse();
|
||||
}
|
||||
}
|
||||
|
@@ -49,16 +49,17 @@ import java.util.Set;
|
||||
@RequiredArgsConstructor
|
||||
public class LogInterceptor implements HandlerInterceptor {
|
||||
|
||||
private final LogDao dao;
|
||||
private final LogProperties properties;
|
||||
private final LogDao logDao;
|
||||
private final LogProperties logProperties;
|
||||
private final TransmittableThreadLocal<LogRecord.Started> timestampTtl = new TransmittableThreadLocal<>();
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
|
||||
public boolean preHandle(@NonNull HttpServletRequest request,
|
||||
@NonNull HttpServletResponse response,
|
||||
@NonNull Object handler) {
|
||||
Clock timestamp = Clock.systemUTC();
|
||||
if (this.isRequestRecord(handler, request)) {
|
||||
if (Boolean.TRUE.equals(properties.getIsPrint())) {
|
||||
if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
|
||||
log.info("[{}] {}", request.getMethod(), request.getRequestURI());
|
||||
}
|
||||
LogRecord.Started startedLogRecord = LogRecord.start(timestamp, new RecordableServletHttpRequest(request));
|
||||
@@ -68,17 +69,20 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response,
|
||||
@NonNull Object handler, Exception e) {
|
||||
public void afterCompletion(@NonNull HttpServletRequest request,
|
||||
@NonNull HttpServletResponse response,
|
||||
@NonNull Object handler,
|
||||
Exception e) {
|
||||
LogRecord.Started startedLogRecord = timestampTtl.get();
|
||||
if (null == startedLogRecord) {
|
||||
return;
|
||||
}
|
||||
timestampTtl.remove();
|
||||
Set<Include> includeSet = properties.getInclude();
|
||||
Set<Include> includeSet = logProperties.getInclude();
|
||||
try {
|
||||
LogRecord finishedLogRecord = startedLogRecord.finish(new RecordableServletHttpResponse(response, response.getStatus()), includeSet);
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
LogRecord finishedLogRecord = startedLogRecord.finish(new RecordableServletHttpResponse(response, response
|
||||
.getStatus()), includeSet);
|
||||
HandlerMethod handlerMethod = (HandlerMethod)handler;
|
||||
// 记录日志描述
|
||||
if (includeSet.contains(Include.DESCRIPTION)) {
|
||||
this.logDescription(finishedLogRecord, handlerMethod);
|
||||
@@ -87,11 +91,12 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
if (includeSet.contains(Include.MODULE)) {
|
||||
this.logModule(finishedLogRecord, handlerMethod);
|
||||
}
|
||||
if (Boolean.TRUE.equals(properties.getIsPrint())) {
|
||||
if (Boolean.TRUE.equals(logProperties.getIsPrint())) {
|
||||
LogResponse logResponse = finishedLogRecord.getResponse();
|
||||
log.info("[{}] {} {} {}ms", request.getMethod(), request.getRequestURI(), logResponse.getStatus(), finishedLogRecord.getTimeTaken().toMillis());
|
||||
log.info("[{}] {} {} {}ms", request.getMethod(), request.getRequestURI(), logResponse
|
||||
.getStatus(), finishedLogRecord.getTimeTaken().toMillis());
|
||||
}
|
||||
dao.add(finishedLogRecord);
|
||||
logDao.add(finishedLogRecord);
|
||||
} catch (Exception ex) {
|
||||
log.error("Logging http log occurred an error: {}.", ex.getMessage(), ex);
|
||||
}
|
||||
@@ -104,15 +109,16 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
* @param handlerMethod 处理器方法
|
||||
*/
|
||||
private void logDescription(LogRecord logRecord, HandlerMethod handlerMethod) {
|
||||
// 例如:@Operation(summary="新增部门") -> 新增部门
|
||||
Operation methodOperation = handlerMethod.getMethodAnnotation(Operation.class);
|
||||
if (null != methodOperation) {
|
||||
logRecord.setDescription(StrUtil.blankToDefault(methodOperation.summary(), "请在该接口方法上指定日志描述"));
|
||||
}
|
||||
// 例如:@Log("新增部门") -> 新增部门
|
||||
Log methodLog = handlerMethod.getMethodAnnotation(Log.class);
|
||||
if (null != methodLog && StrUtil.isNotBlank(methodLog.value())) {
|
||||
logRecord.setDescription(methodLog.value());
|
||||
return;
|
||||
}
|
||||
// 例如:@Operation(summary="新增部门") -> 新增部门
|
||||
Operation methodOperation = handlerMethod.getMethodAnnotation(Operation.class);
|
||||
if (null != methodOperation) {
|
||||
logRecord.setDescription(StrUtil.blankToDefault(methodOperation.summary(), "请在该接口方法上指定日志描述"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,21 +129,23 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
* @param handlerMethod 处理器方法
|
||||
*/
|
||||
private void logModule(LogRecord logRecord, HandlerMethod handlerMethod) {
|
||||
// 例如:@Log(module = "部门管理") -> 部门管理
|
||||
Log methodLog = handlerMethod.getMethodAnnotation(Log.class);
|
||||
if (null != methodLog && StrUtil.isNotBlank(methodLog.module())) {
|
||||
logRecord.setModule(methodLog.module());
|
||||
return;
|
||||
}
|
||||
Log classLog = handlerMethod.getBeanType().getDeclaredAnnotation(Log.class);
|
||||
if (null != classLog && StrUtil.isNotBlank(classLog.module())) {
|
||||
logRecord.setModule(classLog.module());
|
||||
return;
|
||||
}
|
||||
// 例如:@Tag(name = "部门管理") -> 部门管理
|
||||
Tag classTag = handlerMethod.getBeanType().getDeclaredAnnotation(Tag.class);
|
||||
if (null != classTag) {
|
||||
String name = classTag.name();
|
||||
logRecord.setModule(StrUtil.blankToDefault(name, "请在该接口类上指定所属模块"));
|
||||
}
|
||||
// 例如:@Log(module = "部门管理") -> 部门管理
|
||||
Log classLog = handlerMethod.getBeanType().getDeclaredAnnotation(Log.class);
|
||||
if (null != classLog && StrUtil.isNotBlank(classLog.module())) {
|
||||
logRecord.setModule(classLog.module());
|
||||
}
|
||||
Log methodLog = handlerMethod.getMethodAnnotation(Log.class);
|
||||
if (null != methodLog && StrUtil.isNotBlank(methodLog.module())) {
|
||||
logRecord.setModule(methodLog.module());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -90,8 +90,8 @@ public final class RecordableServletHttpRequest implements RecordableHttpRequest
|
||||
public Map<String, Object> getParam() {
|
||||
String body = this.getBody();
|
||||
return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body)
|
||||
? JSONUtil.toBean(body, Map.class)
|
||||
: Collections.unmodifiableMap(request.getParameterMap());
|
||||
? JSONUtil.toBean(body, Map.class)
|
||||
: Collections.unmodifiableMap(request.getParameterMap());
|
||||
}
|
||||
|
||||
private StringBuffer appendQueryString(String queryString) {
|
||||
|
@@ -56,7 +56,8 @@ public final class RecordableServletHttpResponse implements RecordableHttpRespon
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
ContentCachingResponseWrapper wrapper = WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class);
|
||||
ContentCachingResponseWrapper wrapper = WebUtils
|
||||
.getNativeResponse(response, ContentCachingResponseWrapper.class);
|
||||
if (null != wrapper) {
|
||||
return StrUtil.utf8Str(wrapper.getContentAsByteArray());
|
||||
}
|
||||
@@ -66,8 +67,6 @@ public final class RecordableServletHttpResponse implements RecordableHttpRespon
|
||||
@Override
|
||||
public Map<String, Object> getParam() {
|
||||
String body = this.getBody();
|
||||
return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body)
|
||||
? JSONUtil.toBean(body, Map.class)
|
||||
: null;
|
||||
return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body) ? JSONUtil.toBean(body, Map.class) : null;
|
||||
}
|
||||
}
|
||||
|
@@ -35,6 +35,6 @@ public class MailAutoConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Mail' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Mail' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -94,8 +94,10 @@ public class MailUtils {
|
||||
* @param files 附件列表
|
||||
* @throws MessagingException /
|
||||
*/
|
||||
public static void sendHtml(Collection<String> tos, String subject, String content, File... files)
|
||||
throws MessagingException {
|
||||
public static void sendHtml(Collection<String> tos,
|
||||
String subject,
|
||||
String content,
|
||||
File... files) throws MessagingException {
|
||||
send(tos, null, null, subject, content, true, files);
|
||||
}
|
||||
|
||||
@@ -109,7 +111,10 @@ public class MailUtils {
|
||||
* @param files 附件列表
|
||||
* @throws MessagingException /
|
||||
*/
|
||||
public static void sendHtml(Collection<String> tos, Collection<String> ccs, String subject, String content,
|
||||
public static void sendHtml(Collection<String> tos,
|
||||
Collection<String> ccs,
|
||||
String subject,
|
||||
String content,
|
||||
File... files) throws MessagingException {
|
||||
send(tos, ccs, null, subject, content, true, files);
|
||||
}
|
||||
@@ -125,8 +130,12 @@ public class MailUtils {
|
||||
* @param files 附件列表
|
||||
* @throws MessagingException /
|
||||
*/
|
||||
public static void sendHtml(Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject,
|
||||
String content, File... files) throws MessagingException {
|
||||
public static void sendHtml(Collection<String> tos,
|
||||
Collection<String> ccs,
|
||||
Collection<String> bccs,
|
||||
String subject,
|
||||
String content,
|
||||
File... files) throws MessagingException {
|
||||
send(tos, ccs, bccs, subject, content, true, files);
|
||||
}
|
||||
|
||||
@@ -142,12 +151,17 @@ public class MailUtils {
|
||||
* @param files 附件列表
|
||||
* @throws MessagingException /
|
||||
*/
|
||||
public static void send(Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject,
|
||||
String content, boolean isHtml, File... files) throws MessagingException {
|
||||
public static void send(Collection<String> tos,
|
||||
Collection<String> ccs,
|
||||
Collection<String> bccs,
|
||||
String subject,
|
||||
String content,
|
||||
boolean isHtml,
|
||||
File... files) throws MessagingException {
|
||||
Assert.isTrue(CollUtil.isEmpty(tos), "请至少指定一名收件人");
|
||||
MimeMessage mimeMessage = MAIL_SENDER.createMimeMessage();
|
||||
MimeMessageHelper messageHelper =
|
||||
new MimeMessageHelper(mimeMessage, true, StandardCharsets.UTF_8.displayName());
|
||||
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, true, StandardCharsets.UTF_8
|
||||
.displayName());
|
||||
|
||||
// 设置基本信息
|
||||
messageHelper.setFrom(SpringUtil.getProperty("spring.mail.username"));
|
||||
|
@@ -26,11 +26,11 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
import top.charles7c.continew.starter.core.constant.StringConstants;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 本地文件自动配置
|
||||
*
|
||||
@@ -42,7 +42,7 @@ import java.util.Map;
|
||||
@AutoConfiguration
|
||||
@RequiredArgsConstructor
|
||||
@EnableConfigurationProperties(LocalStorageProperties.class)
|
||||
@ConditionalOnProperty(name = "continew-starter.storage.local.enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.STORAGE_LOCAL, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private final LocalStorageProperties properties;
|
||||
@@ -58,8 +58,10 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
|
||||
throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern));
|
||||
}
|
||||
registry.addResourceHandler(StrUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN))
|
||||
.addResourceLocations(!location.startsWith("file:") ? String.format("file:%s", this.format(location)) : this.format(location))
|
||||
.setCachePeriod(0);
|
||||
.addResourceLocations(!location.startsWith("file:")
|
||||
? String.format("file:%s", this.format(location))
|
||||
: this.format(location))
|
||||
.setCachePeriod(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +71,6 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[ContiNew Starter] - Auto Configuration 'Storage-Local' completed initialization.");
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Storage-Local' completed initialization.");
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ package top.charles7c.continew.starter.storage.local.autoconfigure;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -30,7 +31,7 @@ import java.util.Map;
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.storage.local")
|
||||
@ConfigurationProperties(PropertiesConstants.STORAGE_LOCAL)
|
||||
public class LocalStorageProperties {
|
||||
|
||||
/**
|
||||
|
13
pom.xml
13
pom.xml
@@ -15,10 +15,10 @@
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ContiNew Starter 是一种特殊类型的 Spring Boot Starter,
|
||||
其作用与常规的 Starter 类似,它可以帮助开发人员快速集成常用的第三方库或工具到 Spring 应用程序中。
|
||||
ContiNew Starter 包含了一系列经过优化和配置的依赖包,可轻松集成到应用中,
|
||||
从而避免开发人员手动引入依赖的麻烦,为 Spring Boot 项目的灵活快速构建提供支持。
|
||||
ContiNew Starter(Continue New Starter)基于“约定优于配置”的理念,
|
||||
再次精简常规配置,提供一个更为完整的配置解决方案,帮助开发人员更加快速的集成常用第三方库或工具到 Spring Boot Web 应用程序中。
|
||||
ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),
|
||||
可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。
|
||||
</description>
|
||||
<url>https://github.com/Charles7c/continew-starter</url>
|
||||
<licenses>
|
||||
@@ -110,8 +110,11 @@
|
||||
<configuration>
|
||||
<java>
|
||||
<removeUnusedImports/>
|
||||
<eclipse>
|
||||
<file>.style/p3c-codestyle.xml</file>
|
||||
</eclipse>
|
||||
<licenseHeader>
|
||||
<file>code-style/license-header</file>
|
||||
<file>.style/license-header</file>
|
||||
</licenseHeader>
|
||||
</java>
|
||||
</configuration>
|
||||
|
Reference in New Issue
Block a user