Spring Boot: Difference between revisions
From My Limbic Wiki
No edit summary |
|||
Line 14: | Line 14: | ||
//Bla Bla Bla | //Bla Bla Bla | ||
} | } | ||
@RestController | @RestController | ||
public class WelcomeController { | public class WelcomeController { | ||
'''@Autowired''' | '''@Autowired''' | ||
private WelcomeService service; | private WelcomeService service; | ||
@RequestMapping("/welcome") | @RequestMapping("/welcome") | ||
public String welcome() { | public String welcome() { |
Revision as of 23:39, 22 September 2019
Comparaison with Spring Boot and Spring https://www.springboottutorial.com/spring-boot-vs-spring-mvc-vs-spring
What's new
Come with:
- Autoconfiguration
- Previously (Spring_MVC) Bean, Resources, Servlet, View Resolver configuration
- Starters (Spring boot starter web ...)
- Bring all the dependencis required to build web applications
Mock - Dependency Injection
@Component public class WelcomeService { //Bla Bla Bla } @RestController public class WelcomeController { @Autowired private WelcomeService service; @RequestMapping("/welcome") public String welcome() { return service.retrieveWelcomeMessage(); } }
Spring Boot Starter Project Options
Dependencies to use in pom.xml available to start faster a spring boot project.
spring-boot-starter-*:
- -web-services - SOAP Web Services
- -web - Web & RESTful applications
- -test - Unit testing and Integration Testing
- -jdbc - Traditional JDBC
- -hateoas - Add HATEOAS features to your services
- -security - Authentication and Authorization using Spring Security
- -data-jpa - Spring Data JPA with Hibernate
- -cache - Enabling Spring Framework’s caching support
- -data-rest - Expose Simple REST Services using Spring Data REST