2022-01-26

IDEA+springboot相关

 

 Multiple markers at this line
- The type org.apache.ibatis.type.TypeHandler cannot be resolved. It is 
 indirectly referenced from required .class files
- The type org.apache.ibatis.type.JdbcType cannot be resolved. It is 
 indirectly referenced from required .class files

说明你目前版本的Eclipse太旧了,不支持JDK1.8了,要么换最新版本的Eclipse,要么用IDEA。

 

 有时候,明明pom.xml里添加了外部架包,代码里也能正常运行,查是源码里就是提示报错,说类不存在,刷新这里就好了,maven更新不及时的原因:

IDEA+springboot相关

 

外部架包jar里用到了一个Service, 但是本部项目却识别不了它,说bean不存在。

解决办法1:File -> Project Structure -> 左边菜单找到Facets -> 中间菜单选中 Spring(xxx) -> 再点左边框上边沿的+号 -> 

在打开的对话框中选 + 号

IDEA+springboot相关

 

 选中Code-base configurations 然后选中你外部包bean所在的java文件就好。

感觉这个不是最优方案,先这样做吧,反正不报错了。

2022-01-27

如果想Eclipse打我maven jar包可以给idea用,需要共用一个setting.xml文件。

IDEA中 File -> Settings -> 搜索maven

IDEA+springboot相关

2022-01-28

OxmSerializer的配置。(OxmSerializer是把bean转成xml字符串)

@Configuration
public class RedisConfig {

    @Bean
    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
        RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>();
        template.setConnectionFactory(redisConnectionFactory);
        OxmSerializer serializer = new OxmSerializer();
        try{
            Jaxb2Marshaller marshaller = new Jaxb2Marshaller();//创建JAXB上下文环境
            Map<String,Object> properties = new HashMap<String, Object>();//创建映射,用于设置Marshaller属性
            properties.put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);   //放置xml自动缩进属性
            marshaller.setClassesToBeBound(Resp.class, String.class);//映射的xml类放入JAXB环境中
            marshaller.setMarshallerProperties(properties);//设置Marshaller属性
            serializer.setMarshaller(marshaller);
        }catch(Exception e){
            e.printStackTrace();
        }
        template.setDefaultSerializer(serializer);
        template.setKeySerializer(new StringRedisSerializer());//这个很重要,否则系统key也去序列化
        return template;
    }
}

2022-02-10

找不到jar里面的bean,加@SpringBootApplication(scanBasePackages = {"com.dr.iptv.ubp"})

2022-02-14

手动创建的目录src/test/java没有识别为测试代码目录(不能加包package,加类class)。可以选中java目录,右击弹出列表中选“Mark Directory as”

IDEA+springboot相关

 

相关文章: