项目的一些Bug

Not registered via @EnableConfigurationProperties, 
marked as Spring component, or scanned via @ConfigurationPropertiesScan.

当使用@ConfigurationProperties时IDEA顶部出现这样的提示:

错误原因:

ConfigurationProperties使用spring-boot-configuration-processor jar 轻松地从带有注释的项目中生成自己的配置元数据文件 。
该jar包含一个Java注释处理器,在项目被编译时会被调用。要使用处理器,请包含对的依赖 spring-boot-configuration-processor。

1. 在配置文件pom.xml中添加依赖:
2. 回到自定义的bean Person中,添加注解@Component,声明将这个组件添加至容器中,这样才可以被使用

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
    <optional>true</optional>
</dependency>

若target中classes目录下的mapper目录下的xml目录不存在
配置如下方法XMl才能被扫描到 

 

方法1

    <build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
        </resource>
        <!--指定src/main/resources资源要过滤-->
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    </build>

方法2

!--在build中配置resources,来防止我们资源导出失败的问题-->
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

进行spring与mybatis进行整合的时候遇到了一个错误,报错如下

​​​​​​​Error attempting to get column 'title' from result set.
其实代码没错,是因为实体类中少了无参构造方法,加上即可。
@AllArgsConstructor
@NoArgsConstructor

由于springFramework 中配置了springSecurity的依赖而报错 因为admin-blog 引入了springFramework
​​​​​​​

Field authenticationManager in com.sangeng.service.impl.BlogLoginServiceImpl
required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.
The injection point has the following annotations:
@org.springframework.beans.factory.annotation.Autowired(required=true)
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    @Bean // 注入容器
    public AuthenticationManager authenticationManagerBean()  throws Exception {
        return super.authenticationManagerBean();
    }
    @Autowired
    private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;

    @Autowired
    AuthenticationEntryPoint authenticationEntryPoint;
    @Autowired
    AccessDeniedHandler accessDeniedHandler;


    @Bean
    public PasswordEncoder passwordEncoder(){

        return new BCryptPasswordEncoder();
    }
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                //关闭csrf (前后端分离)
                .csrf().disable()
                //不通过Session获取SecurityContext
                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
                .authorizeRequests()
                // 对于登录接口 允许匿名访问
                .antMatchers("/user/login").anonymous()
                //.antMatchers("/logout").authenticated()
                //.antMatchers("/comment").authenticated()
                //.antMatchers("/upload").authenticated()
                //.antMatchers("/link/getAllLink").authenticated()  不需要认证后才能查询
                // 除上面外的所有请求全部不需要认证即可访问
                .anyRequest().authenticated();

        //配置异常处理器
        http.exceptionHandling()
                .authenticationEntryPoint(authenticationEntryPoint)
                .accessDeniedHandler(accessDeniedHandler);

        // 关于springSecurity的默认注销功能
        http.logout().disable();

        //把jwtAuthenticationTokenFilter添加到SpringSecurity的过滤器链中
        http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
        //允许跨域
        http.cors();
    }

}

Invalid bound statement (not found): 在这里使用sql语句解决

问题描述:查看了target中clasees目录里的mapper目录下的xml文件发现已经映射成功!

但仍然报错:Invalid bound statement (not found): 可采用sql语句语句解决

package com.sangeng.mapper;


import com.sangeng.entity.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;


public interface MenuMapper extends BaseMapper<Menu> {




    // bug  Invalid bound statement (not found): 在这里使用sql语句解决
    @Select( " SELECT " +
         " DISTINCT m.id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, " +
    " IFNULL(m.perms,'') AS perms, m.is_frame,  m.menu_type, m.icon, m.order_num, m.create_time " +
            "FROM " +
            "`sys_menu` m " +
            "WHERE " +
    "m.`menu_type` IN ('C','M') AND " +
    "m.`status` = 0 AND " +
    "m.`del_flag` = 0 " +
    "ORDER BY " +
    "m.parent_id,m.order_num")
    List<Menu> selectAllRouterMenu();





}

问题描述:自定义DTO(数据传输对象,Data Transfer Object),若字段名称与entity中的字段一致
 

sql语句正确方式如下

 @Insert(" insert into sg_tag  (name,remark) values (#{name},#{remark})")
    boolean addTag(TagListDto tagListDto);
sql语句书写错误方式如下:
@Insert(" insert into sg_tag  (name,remark) values
(#{tagListDto.getName()},#{tagListDto.getRemark()})")

自动更新填充字段  唯有MP自带的方法才可生效

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
项目管理 bug 管理系统是一种用于帮助团队有效管理和解决项目中存在的错误和问题的工具。这种系统一般包括以下几个方面的功能和特点: 1. 缺陷跟踪:系统能够记录、追踪和分析项目中的各类缺陷,包括软件错误、功能缺失、用户界面问题等。每个缺陷都会被分配一个唯一的标识符,方便团队进行追踪和沟通。 2. 缺陷报告:系统能够帮助项目团队成员快速、准确地提交缺陷报告。报告中应包含缺陷的描述、复现步骤、截图或录屏等信息,以便开发人员更好地定位和修复问题。 3. 缺陷分配:系统能够根据缺陷的严重程度、紧急程度和责任人等因素自动将缺陷分配给相应的开发人员或团队。这样可以确保每个缺陷都能在合理的时间内被处理和解决。 4. 缺陷状态管理:系统能够跟踪每个缺陷的处理进度,包括被分配、正在处理、已解决和已验证等状态。这样可以帮助团队及时了解缺陷的处理情况,及时做出响应和调整。 5. 缺陷分析和统计:系统能够对项目中的缺陷进行统计和分析,包括缺陷分类、缺陷分布、缺陷趋势等。这样可以帮助团队发现项目中存在的问题和可改进之处,提高项目的质量和效率。 总之,项目管理 bug 管理系统是一种重要的工具,可以帮助团队有效地管理和解决项目中出现的错误和问题,提高项目的质量和成功率。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值