Skip to content

Projecto for Semana Spring React from devsuperior.com.br

Notifications You must be signed in to change notification settings

joaoduartepinto/ssrdevsup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project developed at Spring React Week developed by devsuperior.com.br

Snippets/How to

Pagination

Method in controller accepts a Paginable and returns a Page, all subsequents methos must accept and return the same.

controller-pagination

pagination-1

pagination-2

Query

query

SecurityConfig

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private Environment env;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        if (Arrays.asList(env.getActiveProfiles()).contains("test")) {
            http.headers().frameOptions().disable();
        }

        http.cors().and().csrf().disable();
        http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
        http.authorizeRequests().anyRequest().permitAll();
    }

    @Bean
    CorsConfigurationSource corsConfigurationSource() {
        CorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues();
        configuration.setAllowedMethods(Arrays.asList("POST", "GET", "PUT", "DELETE", "OPTIONS"));
        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        source.registerCorsConfiguration("/**", configuration);
        return source;
    }
}

Heroku

  • Create Account and an App.

  • To application.properties add:

spring.profiles.active=${APP_PROFILE:test}

spring.jpa.open-in-view=false
  • application-prod.properties
spring.datasource.url=${DATABASE_URL}

Create a system.properties file at root of project and add:

java.runtime.version=11

In Heroku, we must add Postgres plugin.

Add system variables:

system-variables

Connect db to pgAdmin:

db-data

pgAdmin-1

pgAdmin-2

pgAdmin-3

Now, create the db layout with create.sql and instroduce fake data with data.sql.

To conect the project to heroku:

heroku -v
heroku login
heroku git:remote -a <app-name>
git remote -v
git subtree push --prefix <subtree-folder> heroku master

About

Projecto for Semana Spring React from devsuperior.com.br

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published