上次写了一个博客系统,只是显示博客,所以这个准备写一个博客管理系统。
功能:管理员登录,注册,权限管理,博客编辑,博客发布,富文本输入等等。
使用技术:springBoot+Mybatis+thymeleaf
come on;
构建完成之后出现这个问题
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-11-13 22:26:28.325 ERROR 11924 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Process finished with exit code 1
出现这个错误主要是你没有配置数据库
解决方案<1>
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class ManageApplication {
public static void main(String[] args) {
SpringApplication.run(ManageApplication.class, args);
}
}
@SpringBootApplication 自动化配置相关的东西
解决方案<2>
在application.yml文件中配置myBatis和datasource
配置DataSourceConfig Druid数据源配置并添加sql监控
@Configuration
public class DataSourceConfig {
@ConfigurationProperties(prefix = "datasource.druid")
@Bean(name = "datasource", initMethod = "init", destroyMethod = "close")
public DruidDataSource getDataSource() {
return new DruidDataSource();
}
@Bean
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(getDataSource());
}
// 开启监控
@Bean
public FilterRegistrationBean druidFilter() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new WebStatFilter());
Map<String, String> intParams = new HashMap<>();
intParams.put("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
registration.setName("DruidWebStatFilter");
registration.setUrlPatterns(Lists.newArrayList("/*"));
registration.setInitParameters(intParams);
return registration;
}
//数据源监控
@Bean
public ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean registration = new ServletRegistrationBean();
registration.setServlet(new StatViewServlet());
registration.setName("druid");
registration.setUrlMappings(Lists.newArrayList("/druid/*"));
//自定义添加初始化参数
Map<String, String> intParams = new HashMap<>();
intParams.put("loginUsername", "358812885");
intParams.put("loginPassword", "wangzhen");
registration.setName("DruidWebStatFilter");
registration.setInitParameters(intParams);
return registration;
}
}
在浏览器输入 http://localhost:8080/druid/index.html
使用git上传
首先添加忽略文件规则
提交完成,睡觉。。。。。