GithubHelp home page GithubHelp logo

xujijun / spring-boot-101 Goto Github PK

View Code? Open in Web Editor NEW
194.0 29.0 169.0 230 KB

Guides to spring-boot configurations, such as mybatis, redis, cache, etc.

License: Apache License 2.0

Java 98.12% FreeMarker 1.88%

spring-boot-101's Introduction

spring-boot-101

A handy code guidance of spring-boot.

Functionality List

  • Web configuration and static page support
  • log4j2 configuration
  • mySql and myBatis configuration
  • mongoDB configuration
  • Redis Cluster configuration
  • Caffeine Cache configuration
  • RESTful API
  • Different configuration profiles for different environments
  • Retrieve properties from application.yml (refer to: read-properties)
  • Velocity template (deprecated)
  • FreeMarker template
  • Mail
  • Scheduler
  • @Async configuration
  • Actuator: service status monitor
  • AOP, interceptor
  • web-socket: server(java) and client(html with vue.js)

spring-boot-101's People

Contributors

dependabot[bot] avatar xujijun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-boot-101's Issues

@RequestMapping 不注解在类上,返回值的格式为xml

`@RestController
public class AdminController {

//@Value("${spring.profiles}")
//private String env;

private String userName = "admin";
private String pw = "pword";

/**
 * 登录
 * @param response:用于保存token到cookie中
 * @param map:包含userName和password
 * @return
 */
@RequestMapping("/login")
public JsonResult login(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> map) {
	if(userName.equals(map.get("userName")) && pw.equals(map.get("password"))){
		return new JsonResult(ResultCode.SUCCESS, "登录成功!", null);
	}else {
		return new JsonResult(ResultCode.NOT_LOGIN, "登录失败!", null);
	}
}

}`
此时访问 http://localhost:8080/login?userName=admin&password=pword 返回的是 xml 格式
《JsonResult》
《code》 200 《code》
《message》登录成功!《message》
《data》
《JsonResult》

如果在类名上面这么些
@RestController @RequestMapping("/api/admin") public class AdminController
返回值的格式为json字符串 {"code":"200","message":"登录成功!","data":null}

请问这个是为什么?

按你这个配置 启动抱错

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\code_repository\spring-boot-starter\springboot-demo-mvc\target\classes\com\springboot\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': No qualifying bean of type [org.apache.ibatis.session.SqlSessionFactory] is defined: expected single matching bean but found 2: sqlSessionFactory1,sqlSessionFactory2; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.apache.ibatis.session.SqlSessionFactory] is defined: expected single matching bean but found 2: sqlSessionFactory1,sqlSessionFactory2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.