Search Posts

Category: spring-boot

No ‘Access-Control-Allow-Origin’ header is present on the requested resource with Spring Boot and Angular JS [duplicate]

This question already has an answer here: How to enable CORS in AngularJs 4 answers I have written and angular js program where I am doing a get Request and trying to fetch a resource from a spring Boot rest service. But I am getting this error : No ‘Access-Control-Allow-Origin’ header is present on the requested resource In Angular Js : ctrl.js (function(){ “use strict”; angular.module(“app”) .controller(“chatCtrl”,function($scope,$http){ $scope.name = “ujjawal”; $scope.usermessages = []; $scope.botmessages = […]

AngularJS $http.get(…).success is not a function? [duplicate]

This question already has an answer here: $http.get(…).success is not a function 3 answers I’m trying to update code from angularjs 1.4.8 to 1.6.6, this means that i’m getting an error as .success and .error have now be deprecated…I’ve tried googling and following existing examples on stackoverflow but it just doesn’t seem to work for my code. Can some kind soul help with suggestions on what I should change the following function to: $scope.login = […]

How to attach request params in spring which is retrieved from front end?

I tried this code below…can anyone kindly help me how to pass the params to the spring method and is it a correct implementation in angularjs. @GetMapping(“/extended-registered-time”) public ResponseEntity<List<Registered_time>> getSubLeaves(@ApiParam Pageable pageable) { log.debug(“REST request to get registered time : {}”, pageable); LocalDate startDate = LocalDate.of(2018,01,15); LocalDate endDate = LocalDate.of(2018,01,24); List<Registered_time> result = ExtendedRegisteredTimeService. getSelectedRegisteredTime(startDate,endDate); return new ResponseEntity<>(result, HttpStatus.OK); } This is the frontend implementation(AngularJs) .factory(‘RegisteredTimeService’, RegisteredTimeService); RegisteredTimeService.$inject = [‘$resource’]; function RegisteredTimeService ($resource) { var […]

Angular JS and Springboot integration using rest api

I am trying to connect two different small applications. Client application is in Angular 5 and Server side is in Spring boot. Angular 5 application works fine on localhost:4200/register port and Spring boot (Server Side) works fine on port localhost:8080/api/demo. For integration I have used added a proxy.conf.json file in Angular Application. I have updated package.json script also. Followed the instruction on the website: http://javasampleapproach.com/java-integration/integrate-angular-4-springboot-web-app-springtoolsuite#5_Import_Angular4_client_project_to_SpringToolSuite. Both the projects are in same workspace. Angular project files […]

Spring boot template might not exist or might not be accessible by any of the configured Template Resolvers

Error resolving template “producaoPrimaria”, template might not exist or might not be accessible by any of the configured Template Resolvers I got this erros when i try to access this tamplate i using angularJs in my front-end the method that call template is this $scope.saude = function(idSistemaSelecionado) { idEntidadeSelecionada = $location.$$search.dataBase; $q.when(); if(idSistemaSelecionado ==502){ location.href = “arrecadacao/producaoPrimaria/producaoPrimaria?dataBase=” + idEntidadeSelecionada + “&app=” + idSistemaSelecionado; } }; and my appController app.config(function($routeProvider, $locationProvider,$qProvider){ $qProvider.errorOnUnhandledRejections(false); $routeProvider .when(“/producaoPrimaria”, {templateUrl:’/arrecadacao/producaoPrimaria/producaoPrimariaPaginas/inicioPp.html’, controller:’inicioPpController’}) […]

NullPointerException From front end angular js to back end spring boot

I ‘m working an application using angular js front end and spring boot in back end. I want to affect hotel to user by inserting data into the table usersHotels which is a relation ManyToMany between table gui-user and SystemDefHotel.My problem that when i send data from the front to back i get: error 500() NullPointerException which means the back end has received null value from front end this is my class UsersHotels: public class […]

Spring Boot CSRF fails when handled by Load balancer

I have implemented CSRF filter in spring boot by using header based token method. When I run on single server my applications works well, when I introduce another server or request that serverd by load balancer (depends on how load balancer serves request) it fails to validate the token given by the other server. Can anyone here tell me that how can we create token for CSRF based on particular key which will be same […]

Error in multi file upload using Angular1 "Required request part ‘file’ is not present"

My code for multi file upload is as below: The HTML file <div class=”col-xs-6 folder-struct-1″> <h3>Drop File1:</h3> <div ngf-drop ngf-select=”uploadFiles1($files)” ng-model=”folder1″ class=”drop-box” name=”file1″ ngf-drag-over-class=”‘dragover'” ngf-multiple=”true” ngf-allow-dir=”true” accept=”‘.java'”>Click here to upload <b>JAVA files</b> only</div> <div ngf-no-file-drop>File Drag/Drop is not supported for this browser</div> Files: <ul> <li ng-repeat=”f in folder1″>{{f.name}} {{f.$error}} {{f.$errorParam}}</li> </ul> </div> The controller to handle this. angular.module(‘uiApp’) .controller(‘MainCtrl’,[ ‘$scope’, ‘Upload’, function ($scope, Upload) { // $scope.selectedFile1 = null; $scope.selectedFile2 = null; $scope.fileArray = []; […]

Next Page »