Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spring.jpa.hibernate.ddl-auto=validate or none
- server.port=8080
- spring.datasource.url=jdbc:oracle:thin:@//qdb:1710/qschema
- spring.datasource.username=CRUDUSER
- spring.datasource.password=crudpassword
- spring.datasource.driverClassName = oracle.jdbc.OracleDriver
- spring.jdbc.template.fetch-size=-1
- spring.jdbc.template.max-rows=-1
- spring.jdbc.template.query-timeout=200
- spring.h2.console.enabled=false
- spring.h2.console.path=/h2
- spring.data.jpa.repositories.enabled=true
- spring.jpa.generate-ddl=false
- spring.jpa.hibernate.ddl-auto=none
- spring.jpa.open-in-view=true
- spring.jpa.show-sql=true
- spring.flyway.enabled=false
- spring.jpa.properties.javax.persistence.validation.mode=none
- import org.springframework.boot.Banner;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- @SpringBootApplication
- public class AppApplication {
- public static void main(String[] args) {
- String[] appArgs = {"--debug"};
- SpringApplication app = new SpringApplication(AppApplication.class);
- app.setBannerMode(Banner.Mode.OFF);
- app.setLogStartupInfo(false);
- app.run(appArgs);
- }
- }
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- @RestController
- public class HomeController {
- @RequestMapping("/")
- public String home() {
- return " You've reached the home controller";
- }
- @RequestMapping("/admin")
- public String admin() {
- return " You've reached the admin home controller";
- }
- @RequestMapping("/dashboard")
- public String dashdoard() {
- return " You've reached the dashboard home controller";
- }
- @RequestMapping("/serviceCenter")
- public String serviceCenter() {
- return " You've reached the serviceCenter home controller";
- }
- // @RequestMapping("/error")
- // public String error() {
- // return " You've reached the error page";
- // }
- }
- package com.fpl.pdit.model;
- import java.util.Date;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.Id;
- import org.hibernate.annotations.Immutable;
- @Entity
- @Immutable
- public class Center {
- @Id
- @Column
- String symbol;
- @Column
- String center;
- @Column
- String messaging;
- @Column
- String slid;
- @Column
- Date last_modified;
- @Column
- String area_name;
- public Center() {}
- public Center(String symbol, String center, String messaging, String slid, Date last_modified,
- String area_name) {
- super();
- this.symbol = symbol;
- this.center = center;
- this.messaging = messaging;
- this.slid = slid;
- this.last_modified = last_modified;
- this.area_name = area_name;
- }
- public String getSymbol() {
- return symbol;
- }
- public void setSymbol(String symbol) {
- this.symbol = symbol;
- }
- public String getcenter() {
- return center;
- }
- public void setCenter(String center) {
- this.center = center;
- }
- public String getMessaging() {
- return messaging;
- }
- public void setMessaging(String messaging) {
- this.messaging = messaging;
- }
- public String getSlid() {
- return slid;
- }
- public void setSlid(String slid) {
- this.slid = slid;
- }
- public Date getLast_modified() {
- return last_modified;
- }
- public void setLast_modified(Date last_modified) {
- this.last_modified = last_modified;
- }
- public String getArea_name() {
- return area_name;
- }
- public void setArea_name(String area_name) {
- this.area_name = area_name;
- }
- }
- package com.fpl.pdit.controller;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- public class CenterStub {
- private static Map <String, Center> centers = new HashMap <String, Center> ();
- static {
- ServiceCenter sc = new Center("WWW","Center0","Y", null, null, null);
- centers.put(sc.getCenter(), sc);
- sc = new Center("XXX","Center1","Y", null, null, null);
- centers.put(sc.getCenter(), sc);
- sc = new Center("YYY","Center2","Y", null, null, null);
- centers.put(sc.getcenter(), sc);
- }
- public static List<Center> list() {
- return new ArrayList<Center>(centers.values());
- }
- public static Center get(String symbol) {
- return centers.get(symbol);
- }
- public static Center update(String symbol, Center sc) {
- centers.put(symbol, sc);
- return sc;
- }
- }
- import java.util.List;
- import org.springframework.data.jpa.repository.JpaRepository;
- import org.springframework.data.jpa.repository.Query;
- import com.fpl.pdit.model.Center;
- public interface CenterRepository extends JpaRepository<Center, String>{
- }
- import javax.sql.DataSource;
- import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
- import org.springframework.boot.context.properties.ConfigurationProperties;
- import org.springframework.boot.jdbc.DataSourceBuilder;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.context.annotation.Primary;
- import com.zaxxer.hikari.HikariDataSource;
- @Configuration
- public class PersistenceConfiguration {
- @Bean
- @ConfigurationProperties(prefix="spring.datasource")
- @Primary
- public DataSource dataSource() {
- return DataSourceBuilder.create().build();
- }
- @Bean
- @ConfigurationProperties("spring.datasource")
- public HikariDataSource dataSource(DataSourceProperties properties) {
- return properties.initializeDataSourceBuilder().type(HikariDataSource.class)
- .build();
- }
- }
Add Comment
Please, Sign In to add comment