
spring_boot
91奔跑的蜗牛
这个作者很懒,什么都没留下…
展开
-
SpringBoot 属性注入 ConfigurationProperties
问题:ConfigurationProperties如何进行对象的赋值,例, JdbcProperties中有 View对象,如何初始化View中的 prefix,suffix@ConfigurationProperties(prefix = "jdbc")public class JdbcProperties { private String driverClassName;...原创 2020-04-15 15:13:44 · 979 阅读 · 0 评论 -
idea springboot 导入依赖的时候,报错 unknown
org.springframework.boot:spring-boot-starter-jdbc:unknown预测是父工程,spring-boot-starter-jdbc 没有指定版本,默认的版本不支持。>spring-boot-starter-parent是 2.2.5,设置spring-boot-starter-jdbc版本也为 2.2.5,测试通过...原创 2020-04-07 11:37:08 · 1514 阅读 · 0 评论 -
srping-boot 无法用两个不同的端口启动服务
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency>问题描述:例如第一个启动8081端口成功后,修改端口为80...原创 2020-03-30 11:17:08 · 410 阅读 · 0 评论 -
springboot 事务管理 @Transactional
1、当方法上没有加@Transactional ,此时执行删除操作,在删除操作后出现了异常,此刻删除操作是不会回滚的。 public void deleteEmpById(Integer empNo){ EmpExample empExample = new EmpExample(); EmpExample.Criteria criteria = em...原创 2020-02-27 16:18:34 · 382 阅读 · 0 评论 -
Invalid bound statement (not found): com.heima.mapper.EmpMapper.selectByExample] with root cause
springboot 整合 mybatis的时候报错:nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.heima.mapper.EmpMapper.selectByExample] with root cause分析:没有扫描到 m...原创 2020-02-27 14:27:27 · 1153 阅读 · 0 评论 -
java 注解 @Configuration @Bean
@Configuration:声明一个类作为配置类,代替xml文件@Bean:声明在方法上,将方法的返回值加入Bean容器,代替`<bean>`标签通常 @Configuration 和@Bean 是一起使用的@Configuration@EnableConfigurationProperties(JdbcProperties.class)public class J...原创 2020-02-27 09:32:02 · 384 阅读 · 0 评论 -
springboot 工程,controller类中导入mapper,报红线错误
虽然报了红线错误,但是工程可以正常运行。如果想解决这个红线错误提示,可以在EmpMapper上添加注解 @Component("empMaper")//@Mapper标记该类是一个mybatis的mapper接口,可以被spring boot自动扫描到spring上下文中@Mapper/*@Component("empMaper") 解决@Autowired注入该EmpMapp...原创 2019-12-09 14:23:10 · 1840 阅读 · 0 评论 -
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;
在做springboot 与 mybatis的集成时候,报错Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;这是因为pom.xml中导入的mysql驱动依赖,没有配置version,默认使用spring-boot-starter-parent配置...原创 2019-12-09 14:07:52 · 5509 阅读 · 2 评论 -
restful 风格的url,参数写在url的 / 后面,而不是 ? 后面
如下url就是一个 restful 风格的 url:http://localhost:8080/hello/zhangsan/25/male我们来看下对应的controller类:@Controllerpublic class QuickStartController02 { /* /hello/{paramName}/{paramAge}/{gender},在...原创 2019-12-09 10:17:25 · 3462 阅读 · 0 评论