java - Spring Boot without Model + MySQL -


i need make application without using models, because require make model every tables - isn't needed me.

we can go class execute queries directly or rest api.

has have idea achieving this?

as suggested in other answers, not require models.

see spring boot documentation , can download simple working example

  1. you need have application.properties file properties below
spring.datasource.url=jdbc:mysql://localhost:3306/test spring.datasource.username=dbuser spring.datasource.password=dbpass spring.datasource.driver-class-name=com.mysql.jdbc.driver 
  1. add spring boot jdbc dependency in pom.xml

    <dependency>     <groupid>org.springframework.boot</groupid>     <artifactid>spring-boot-starter-jdbc</artifactid> </dependency> 
  2. you want inject jdbctemplate in controller class or other component scanned class,

private final jdbctemplate jdbctemplate;   @autowired  public mycontroller(jdbctemplate jdbctemplate) {     this.jdbctemplate = jdbctemplate;  } 

in way can autowire jdbctemplate in spring bean.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -