http_sub_module / sub_filter of nginx and reverse proxy not working

Check if the upstream source has gzip turned on, if so you need proxy_set_header Accept-Encoding “”; so the whole thing would be something like location / { proxy_set_header Accept-Encoding “”; proxy_pass http://upstream.site/; sub_filter_types text/css; sub_filter_once off; sub_filter .upstream.site special.our.domain; } Check these links https://www.ruby-forum.com/topic/178781 https://forum.nginx.org/read.php?2,226323,226323 http://www.serverphorums.com/read.php?5,542078

Getting Unknown Provider error when injecting a Service into an Angular unit test

I just ran into this and solved it by switching to getting the service using the $injector explicitly: var EventingService, $rootScope; beforeEach(inject(function($injector) { EventingService = $injector.get(‘EventingService’); $rootScope = $injector.get(‘$rootScope’); })); I wish I could tell you why this works and why the simple beforeEach(inject(function(EventingService) { …. })); does not, but I don’t have the time … Read more

Difference between javax.inject.Singleton and javax.ejb.Singleton

I found a plausible explanation here: By default, javax.ejb.Singleton session beans are transactional (section 13.3.7 of the EJB 3.1 specification) and require acquisition of an exclusive lock for every business method invocation (sections 4.8.5.4 and 4.8.5.5). In contrast, a javax.inject.Singleton is not transactional and does not support container-managed concurrency (the major consequence being that no … Read more

Define AngularJS directive using TypeScript and $inject mechanism

Using classes and inherit from ng.IDirective is the way to go with TypeScript: class MyDirective implements ng.IDirective { restrict=”A”; require=”ngModel”; templateUrl=”myDirective.html”; replace = true; constructor(private $location: ng.ILocationService, private toaster: ToasterService) { } link = (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, ctrl: any) => { console.log(this.$location); console.log(this.toaster); } static factory(): ng.IDirectiveFactory { const directive = ($location: … Read more

Is it possible to inject interface with angular2?

No, interfaces are not supported for DI. With TypeScript interfaces are not available at runtime anymore, only statically and therefore can’t be used as DI tokens. Alternatively you can use strings as keys or InjectionToken provide(‘CoursesServiceInterface’, {useClass: CoursesServiceMock}) // old providers: [{provide: ‘CoursesServiceInterface’, useClass: CoursesServiceMock}] and inject it like constructor(@Inject(‘CoursesServiceInterface’) private coursesService:CoursesServiceInterface) {} See also … Read more

inject bean reference into a Quartz job in Spring?

You can use this SpringBeanJobFactory to automatically autowire quartz objects using spring: import org.quartz.spi.TriggerFiredBundle; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.scheduling.quartz.SpringBeanJobFactory; public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware { private transient AutowireCapableBeanFactory beanFactory; @Override public void setApplicationContext(final ApplicationContext context) { beanFactory = context.getAutowireCapableBeanFactory(); } @Override protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception { … Read more

Inheritance and dependency injection

I could solve this by injecting MyService within each and every component and use that argument for the super() call but that’s definetly some kind of absurd. It’s not absurd. This is how constructors and constructor injection works. Every injectable class has to declare the dependencies as constructor parameters and if the superclass also has … Read more

tech